Lines Matching refs:Value
39 static inline uint32_t Hi_32(uint64_t Value) { in Hi_32() argument
40 return (uint32_t)(Value >> 32); in Hi_32()
44 static inline uint32_t Lo_32(uint64_t Value) { in Lo_32() argument
45 return (uint32_t)(Value); in Lo_32()
63 static inline bool isMask_32(uint32_t Value) { in isMask_32() argument
64 return Value && ((Value + 1) & Value) == 0; in isMask_32()
70 static inline bool isMask_64(uint64_t Value) { in isMask_64() argument
71 return Value && ((Value + 1) & Value) == 0; in isMask_64()
77 static inline bool isShiftedMask_32(uint32_t Value) { in isShiftedMask_32() argument
78 return isMask_32((Value - 1) | Value); in isShiftedMask_32()
83 static inline bool isShiftedMask_64(uint64_t Value) { in isShiftedMask_64() argument
84 return isMask_64((Value - 1) | Value); in isShiftedMask_64()
89 static inline bool isPowerOf2_32(uint32_t Value) { in isPowerOf2_32() argument
90 return Value && !(Value & (Value - 1)); in isPowerOf2_32()
97 static inline unsigned CountLeadingZeros_32(uint32_t Value) { in CountLeadingZeros_32() argument
102 if (!Value) return 32; in CountLeadingZeros_32()
104 Count = __builtin_clz(Value); in CountLeadingZeros_32()
107 if (!Value) return 32; in CountLeadingZeros_32()
111 uint32_t Tmp = Value >> Shift; in CountLeadingZeros_32()
113 Value = Tmp; in CountLeadingZeros_32()
126 static inline unsigned CountLeadingOnes_32(uint32_t Value) { in CountLeadingOnes_32() argument
127 return CountLeadingZeros_32(~Value); in CountLeadingOnes_32()
134 static inline unsigned CountLeadingZeros_64(uint64_t Value) { in CountLeadingZeros_64() argument
139 if (!Value) return 64; in CountLeadingZeros_64()
141 Count = __builtin_clzll(Value); in CountLeadingZeros_64()
147 if (!Value) return 64; in CountLeadingZeros_64()
151 uint64_t Tmp = Value >> Shift; in CountLeadingZeros_64()
153 Value = Tmp; in CountLeadingZeros_64()
163 uint32_t Hi = Hi_32(Value); in CountLeadingZeros_64()
171 uint32_t Lo = Lo_32(Value); in CountLeadingZeros_64()
184 static inline unsigned CountLeadingOnes_64(uint64_t Value) { in CountLeadingOnes_64() argument
185 return CountLeadingZeros_64(~Value); in CountLeadingOnes_64()
192 static inline unsigned CountTrailingZeros_32(uint32_t Value) { in CountTrailingZeros_32() argument
194 return Value ? __builtin_ctz(Value) : 32; in CountTrailingZeros_32()
204 return Mod37BitPosition[((1 + ~Value) & Value) % 37]; in CountTrailingZeros_32()
212 static inline unsigned CountTrailingOnes_32(uint32_t Value) { in CountTrailingOnes_32() argument
213 return CountTrailingZeros_32(~Value); in CountTrailingOnes_32()
220 static inline unsigned CountTrailingZeros_64(uint64_t Value) { in CountTrailingZeros_64() argument
222 return Value ? __builtin_ctzll(Value) : 64; in CountTrailingZeros_64()
234 return Mod67Position[((1 + ~Value) & Value) % 67]; in CountTrailingZeros_64()
242 static inline unsigned CountTrailingOnes_64(uint64_t Value) { in CountTrailingOnes_64() argument
243 return CountTrailingZeros_64(~Value); in CountTrailingOnes_64()
249 static inline unsigned CountPopulation_32(uint32_t Value) { in CountPopulation_32() argument
251 return __builtin_popcount(Value); in CountPopulation_32()
253 uint32_t v = Value - ((Value >> 1) & 0x55555555); in CountPopulation_32()
261 static inline unsigned CountPopulation_64(uint64_t Value) { in CountPopulation_64() argument
263 return __builtin_popcountll(Value); in CountPopulation_64()
265 uint64_t v = Value - ((Value >> 1) & 0x5555555555555555ULL); in CountPopulation_64()
275 static inline unsigned Log2_32(uint32_t Value) { in Log2_32() argument
276 return 31 - CountLeadingZeros_32(Value); in Log2_32()
281 static inline unsigned Log2_64(uint64_t Value) { in Log2_64() argument
282 return 63 - CountLeadingZeros_64(Value); in Log2_64()
288 static inline unsigned Log2_32_Ceil(uint32_t Value) { in Log2_32_Ceil() argument
289 return 32-CountLeadingZeros_32(Value-1); in Log2_32_Ceil()
294 static inline unsigned Log2_64_Ceil(uint64_t Value) { in Log2_64_Ceil() argument
295 return 64-CountLeadingZeros_64(Value-1); in Log2_64_Ceil()
389 static inline uint64_t RoundUpToAlignment(uint64_t Value, uint64_t Align) { in RoundUpToAlignment() argument
390 return ((Value + Align - 1) / Align) * Align; in RoundUpToAlignment()
396 static inline uint64_t OffsetToAlignment(uint64_t Value, uint64_t Align) { in OffsetToAlignment() argument
397 return RoundUpToAlignment(Value, Align) - Value; in OffsetToAlignment()