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

Function SetBitTo

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

Source from the content-addressed store, hash-verified

219static inline void SetBit(uint8_t* bits, int64_t i) { bits[i / 8] |= kBitmask[i % 8]; }
220
221static inline void SetBitTo(uint8_t* bits, int64_t i, bool bit_is_set) {
222 // https://graphics.stanford.edu/~seander/bithacks.html
223 // "Conditionally set or clear bits without branching"
224 // NOTE: this seems to confuse Valgrind as it reads from potentially
225 // uninitialized memory
226 bits[i / 8] ^= static_cast<uint8_t>(-static_cast<uint8_t>(bit_is_set) ^ bits[i / 8]) &
227 kBitmask[i % 8];
228}
229
230/// \brief set or clear a range of bits quickly
231ARROW_EXPORT

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected