Lines Matching defs:bits

57 // Return the number of 1-bits in `x`.
65 // Find the bit position of the most significant bit (0-based), or -1 if there were no bits set.
74 // Find the bit position of the least significant bit (0-based), or -1 if there were no bits set.
82 // How many bits (minimally) does it take to store the constant 'value'? i.e. 1 for 1, 3 for 5, etc.
176 // Like sizeof, but count how many bits a type takes. Pass type explicitly.
186 // Like sizeof, but count how many bits a type takes. Infers type from parameter.
222 static constexpr T GetIntLimit(size_t bits) {
224 DCHECK_CONSTEXPR(bits > 0, "bits cannot be zero", 0)
225 DCHECK_CONSTEXPR(bits < BitSizeOf<T>(), "kBits must be < max.", 0)
226 static_cast<T>(1) << (bits - 1);
234 // Corner case for "use all bits." Can't use the limits, as they would overflow, but it is
246 // Corner case for "use all bits." Can't use the limits, as they would overflow, but it is
270 static constexpr T MaxInt(size_t bits) {
272 DCHECK_CONSTEXPR(std::is_unsigned<T>::value || bits > 0, "bits cannot be zero for signed", 0)
273 DCHECK_CONSTEXPR(bits <= BitSizeOf<T>(), "kBits must be < max.", 0)
274 bits == BitSizeOf<T>()
277 ? (bits == 1
279 : static_cast<T>(MaxInt<typename std::make_unsigned<T>::type>(bits - 1)))
280 : static_cast<T>(UINT64_C(1) << bits) - static_cast<T>(1);
284 static constexpr T MinInt(size_t bits) {
286 DCHECK_CONSTEXPR(std::is_unsigned<T>::value || bits > 0, "bits cannot be zero for signed", 0)
287 DCHECK_CONSTEXPR(bits <= BitSizeOf<T>(), "kBits must be < max.", 0)
288 bits == BitSizeOf<T>()
291 ? (bits == 1 ? -1 : static_cast<T>(-1) - MaxInt<T>(bits))
307 explicit BitIteratorBase(T bits) : bits_(bits) { }
363 IterationRange<LowToHighBitIterator<T>> LowToHighBits(T bits) {
365 LowToHighBitIterator<T>(bits), LowToHighBitIterator<T>());
369 IterationRange<HighToLowBitIterator<T>> HighToLowBits(T bits) {
371 HighToLowBitIterator<T>(bits), HighToLowBitIterator<T>());