| 388 | // msb lsb |
| 389 | template <typename T = size_t> |
| 390 | inline static constexpr std::make_unsigned_t<T> MaskLeastSignificant(size_t bits) { |
| 391 | DCHECK_GE(BitSizeOf<T>(), bits) << "Bits out of range for type T"; |
| 392 | using unsigned_T = std::make_unsigned_t<T>; |
| 393 | if (bits >= BitSizeOf<T>()) { |
| 394 | return std::numeric_limits<unsigned_T>::max(); |
| 395 | } else { |
| 396 | auto kOne = static_cast<unsigned_T>(1); // Do not truncate for T>size_t. |
| 397 | return static_cast<unsigned_T>((kOne << bits) - kOne); |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | // Clears the bitfield starting at the least significant bit "lsb" with a bitwidth of 'width'. |
| 402 | // (Equivalent of ARM BFC instruction). |
nothing calls this directly
no outgoing calls
no test coverage detected