Lines Matching +full:64 +full:bit

16 #include "llvm/ADT/bit.h"
84 assert(N <= Bits && "Invalid bit index"); in maskTrailingOnes()
108 /// Macro compressed bit reversal table for 256 bits.
112 #define R2(n) n, n + 2 * 64, n + 1 * 64, n + 3 * 64
153 /// Return the high 32 bits of a 64 bit value.
158 /// Return the low 32 bits of a 64 bit value.
163 /// Make a 64-bit integer from a high / low pair of 32-bit integers.
168 /// Checks if an integer fits into the given bit width.
178 if constexpr (N < 64) in isInt()
184 /// Checks if a signed integer is an N bit number shifted left by S.
187 static_assert(S < 64, "isShiftedInt<N, S> with S >= 64 is too much."); in isShiftedInt()
188 static_assert(N + S <= 64, "isShiftedInt<N, S> with N + S > 64 is too wide."); in isShiftedInt()
192 /// Checks if an unsigned integer fits into the given bit width.
202 if constexpr (N < 64) in isUInt()
208 /// Checks if a unsigned integer is an N bit number shifted left by S.
211 static_assert(S < 64, "isShiftedUInt<N, S> with S >= 64 is too much."); in isShiftedUInt()
212 static_assert(N + S <= 64, in isShiftedUInt()
213 "isShiftedUInt<N, S> with N + S > 64 is too wide."); in isShiftedUInt()
214 // S must be strictly less than 64. So 1 << S is not undefined behavior. in isShiftedUInt()
218 /// Gets the maximum value for a N-bit unsigned integer.
220 assert(N <= 64 && "integer width out of range"); in maxUIntN()
222 // uint64_t(1) << 64 is undefined behavior, so we can't do in maxUIntN()
224 // without checking first that N != 64. But this works and doesn't have a in maxUIntN()
226 // Unfortunately, shifting a uint64_t right by 64 bit is undefined in maxUIntN()
231 return UINT64_MAX >> (64 - N); in maxUIntN()
234 /// Gets the minimum value for a N-bit signed integer.
236 assert(N <= 64 && "integer width out of range"); in minIntN()
243 /// Gets the maximum value for a N-bit signed integer.
245 assert(N <= 64 && "integer width out of range"); in maxIntN()
247 // This relies on two's complement wraparound when N == 64, so we convert to in maxIntN()
254 /// Checks if an unsigned integer fits into the given (dynamic) bit width.
256 return N >= 64 || x <= maxUIntN(N); in isUIntN()
259 /// Checks if an signed integer fits into the given (dynamic) bit width.
261 return N >= 64 || (minIntN(N) <= x && x <= maxIntN(N)); in isIntN()
265 /// least significant bit with the remainder zero (32 bit version).
272 /// least significant bit with the remainder zero (64 bit version).
278 /// remainder zero (32 bit version.) Ex. isShiftedMask_32(0x0000FF00U) == true.
284 /// remainder zero (64 bit version.)
290 /// Ex. isPowerOf2_32(0x00100000U) == true (32 bit edition.)
295 /// Return true if the argument is a power of two > 0 (64 bit edition.)
301 /// remainder zero (32 bit version.) Ex. isShiftedMask_32(0x0000FF00U) == true.
302 /// If true, \p MaskIdx will specify the index of the lowest set bit and \p
315 /// remainder zero (64 bit version.) If true, \p MaskIdx will specify the index
316 /// of the lowest set bit and \p MaskLen is updated to specify the length of the
338 /// (32 bit edition.)
345 /// (64 bit edition.)
351 /// (32 bit edition).
357 /// Return the ceil log base 2 of the specified value, 64 if the value is zero.
358 /// (64 bit edition.)
360 return 64 - llvm::countl_zero(Value - 1); in Log2_64_Ceil()
380 /// Returns the next power of two (in 64-bits) that is strictly greater than A.
553 /// Sign-extend the number in the bottom B bits of X to a 32-bit integer.
556 static_assert(B <= 32, "Bit width out of range."); in SignExtend32()
562 /// Sign-extend the number in the bottom B bits of X to a 32-bit integer.
565 assert(B <= 32 && "Bit width out of range."); in SignExtend32()
571 /// Sign-extend the number in the bottom B bits of X to a 64-bit integer.
572 /// Requires B <= 64.
574 static_assert(B <= 64, "Bit width out of range."); in SignExtend64()
577 return int64_t(x << (64 - B)) >> (64 - B); in SignExtend64()
580 /// Sign-extend the number in the bottom B bits of X to a 64-bit integer.
581 /// Requires B <= 64.
583 assert(B <= 64 && "Bit width out of range."); in SignExtend64()
586 return int64_t(X << (64 - B)) >> (64 - B); in SignExtend64()
655 // We're going to use the top bit, and maybe overflow one
656 // bit past it. Multiply all but the bottom bit then add