| 415 | // lsb 0 |
| 416 | template <typename T> |
| 417 | inline static constexpr T BitFieldClear(T value, size_t lsb, size_t width) { |
| 418 | DCHECK_GE(BitSizeOf(value), lsb + width) << "Bit field out of range for value"; |
| 419 | const auto val = static_cast<std::make_unsigned_t<T>>(value); |
| 420 | const auto mask = MaskLeastSignificant<T>(width); |
| 421 | |
| 422 | return static_cast<T>(val & ~(mask << lsb)); |
| 423 | } |
| 424 | |
| 425 | // Inserts the contents of 'data' into bitfield of 'value' starting |
| 426 | // at the least significant bit "lsb" with a bitwidth of 'width'. |
no test coverage detected