folly::Bits

Wrapper class with static methods for various bit-level operations, treating an array of T as an array of bits (in little-endian order). (T is either an unsigned integral type or Unaligned<X>, where X is an unsigned integral type)

Synopsis

Declared in <folly/lang/BitsClass.h>

template<
    class T,
    class Traits = /* implementation-defined */>
struct Bits;

Type Aliases

NameDescription
UnderlyingType The unsigned integral type backing each block element.
type The element type of the underlying array.

Static Member Functions

NameDescription
bitOffset Offset in block of the given bit.
blockCount Number of blocks used by the given number of bits.
blockIndex Byte index of the given bit.
clear Clear the given bit.
count Count the number of bits set in a range of blocks.
get Get count contiguous bits starting at bitStart. Precondition: count <= sizeof(T) * 8
set set overloads
test Test the given bit.

Static Data Members

NameDescription
bitsPerBlock Number of bits in a block.