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

Function BitSizeOf

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

Source from the content-addressed store, hash-verified

29// Like sizeof, but count how many bits a type takes. Pass type explicitly.
30template <typename T>
31constexpr size_t BitSizeOf() {
32 static_assert(std::is_integral<T>::value, "T must be integral");
33 using unsigned_type = typename std::make_unsigned<T>::type;
34 static_assert(sizeof(T) == sizeof(unsigned_type), "Unexpected type size mismatch!");
35 static_assert(std::numeric_limits<unsigned_type>::radix == 2, "Unexpected radix!");
36 return std::numeric_limits<unsigned_type>::digits;
37}
38
39// Like sizeof, but count how many bits a type takes. Infers type from parameter.
40template <typename T>

Callers 3

BitFieldClearFunction · 0.85
BitFieldInsertFunction · 0.85
BitFieldExtractFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected