folly::get_bit_at

Read the bit at position idx from an array of unsigned integers.

Synopsis

Declared in <folly/lang/Bits.h>

template<typename Uint>
[[nodiscard]]
constexpr
bool
get_bit_at(
    Uint const* ptr,
    std::size_t idx) noexcept;

NOTE

This function is defined as an Algorithm Function Object (AFO).

Return Value

True if the bit at idx is set.

NOTE

The return value should not be discarded.

Parameters

NameDescription
ptrPointer to the first element of the array.
idxThe bit index, counting the lowest bits of each element first.