MCPcopy Create free account
hub / github.com/apache/arrow / PrecedingWordBitmask

Function PrecedingWordBitmask

cpp/src/arrow/util/bit_util.h:247–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245/// ref: https://stackoverflow.com/a/59523400
246template <typename Word>
247constexpr Word PrecedingWordBitmask(const unsigned int i) {
248 return static_cast<Word>(static_cast<Word>(i < sizeof(Word) * 8)
249 << (i & (sizeof(Word) * 8 - 1))) -
250 1;
251}
252static_assert(PrecedingWordBitmask<uint8_t>(0) == 0x00, "");
253static_assert(PrecedingWordBitmask<uint8_t>(4) == 0x0f, "");
254static_assert(PrecedingWordBitmask<uint8_t>(8) == 0xff, "");

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected