MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / BitFieldClear

Function BitFieldClear

Bcore/src/main/cpp/base/bit_utils.h:417–423  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

415// lsb 0
416template <typename T>
417inline 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'.

Callers 1

BitFieldInsertFunction · 0.85

Calls 1

BitSizeOfFunction · 0.85

Tested by

no test coverage detected