Home | History | Annotate | Download | only in capstone

Lines Matching refs:Value

38 /// Hi_32 - This function returns the high 32 bits of a 64 bit value.
39 static inline uint32_t Hi_32(uint64_t Value) {
40 return (uint32_t)(Value >> 32);
43 /// Lo_32 - This function returns the low 32 bits of a 64 bit value.
44 static inline uint32_t Lo_32(uint64_t Value) {
45 return (uint32_t)(Value);
63 static inline bool isMask_32(uint32_t Value) {
64 return Value && ((Value + 1) & Value) == 0;
70 static inline bool isMask_64(uint64_t Value) {
71 return Value && ((Value + 1) & Value) == 0;
77 static inline bool isShiftedMask_32(uint32_t Value) {
78 return isMask_32((Value - 1) | Value);
83 static inline bool isShiftedMask_64(uint64_t Value) {
84 return isMask_64((Value - 1) | Value);
89 static inline bool isPowerOf2_32(uint32_t Value) {
90 return Value && !(Value & (Value - 1));
97 static inline unsigned CountLeadingZeros_32(uint32_t Value) {
102 if (!Value) return 32;
104 Count = __builtin_clz(Value);
107 if (!Value) return 32;
111 uint32_t Tmp = Value >> Shift;
113 Value = Tmp;
126 static inline unsigned CountLeadingOnes_32(uint32_t Value) {
127 return CountLeadingZeros_32(~Value);
134 static inline unsigned CountLeadingZeros_64(uint64_t Value) {
139 if (!Value) return 64;
141 Count = __builtin_clzll(Value);
147 if (!Value) return 64;
151 uint64_t Tmp = Value >> Shift;
153 Value = Tmp;
163 uint32_t Hi = Hi_32(Value);
171 uint32_t Lo = Lo_32(Value);
172 // same as 32 bit value
184 static inline unsigned CountLeadingOnes_64(uint64_t Value) {
185 return CountLeadingZeros_64(~Value);
192 static inline unsigned CountTrailingZeros_32(uint32_t Value) {
194 return Value ? __builtin_ctz(Value) : 32;
201 // Replace "-Value" by "1+~Value" in the following commented code to avoid
203 // return Mod37BitPosition[(-Value & Value) % 37];
204 return Mod37BitPosition[((1 + ~Value) & Value) % 37];
212 static inline unsigned CountTrailingOnes_32(uint32_t Value) {
213 return CountTrailingZeros_32(~Value);
220 static inline unsigned CountTrailingZeros_64(uint64_t Value) {
222 return Value ? __builtin_ctzll(Value) : 64;
231 // Replace "-Value" by "1+~Value" in the following commented code to avoid
233 // return Mod67Position[(-Value & Value) % 67];
234 return Mod67Position[((1 + ~Value) & Value) % 67];
242 static inline unsigned CountTrailingOnes_64(uint64_t Value) {
243 return CountTrailingZeros_64(~Value);
246 /// CountPopulation_32 - this function counts the number of set bits in a value.
249 static inline unsigned CountPopulation_32(uint32_t Value) {
251 return __builtin_popcount(Value);
253 uint32_t v = Value - ((Value >> 1) & 0x55555555);
259 /// CountPopulation_64 - this function counts the number of set bits in a value,
261 static inline unsigned CountPopulation_64(uint64_t Value) {
263 return __builtin_popcountll(Value);
265 uint64_t v = Value - ((Value >> 1) & 0x5555555555555555ULL);
272 /// Log2_32 - This function returns the floor log base 2 of the specified value,
273 /// -1 if the value is zero. (32 bit edition.)
275 static inline unsigned Log2_32(uint32_t Value) {
276 return 31 - CountLeadingZeros_32(Value);
279 /// Log2_64 - This function returns the floor log base 2 of the specified value,
280 /// -1 if the value is zero. (64 bit edition.)
281 static inline unsigned Log2_64(uint64_t Value) {
282 return 63 - CountLeadingZeros_64(Value);
286 /// value, 32 if the value is zero. (32 bit edition).
288 static inline unsigned Log2_32_Ceil(uint32_t Value) {
289 return 32-CountLeadingZeros_32(Value-1);
293 /// value, 64 if the value is zero. (64 bit edition.)
294 static inline unsigned Log2_64_Ceil(uint64_t Value) {
295 return 64-CountLeadingZeros_64(Value-1);
362 // Replace "-Value" by "1+~Value" in the following commented code to avoid
381 /// \p Value and is a multiple of \p Align. \p Align must be non-zero.
389 static inline uint64_t RoundUpToAlignment(uint64_t Value, uint64_t Align) {
390 return ((Value + Align - 1) / Align) * Align;
394 /// or equal to \p Value and is a multiple of \p Align. \p Align must be
396 static inline uint64_t OffsetToAlignment(uint64_t Value, uint64_t Align) {
397 return RoundUpToAlignment(Value, Align) - Value;
400 /// abs64 - absolute value of a 64-bit int. Not all environments support
402 /// value of the largest negative number is undefined, as with "abs".