proxygen
|
#include <Bits.h>
Public Types | |
typedef Traits::UnderlyingType | UnderlyingType |
typedef T | type |
Static Public Member Functions | |
static constexpr size_t | blockIndex (size_t bit) |
static constexpr size_t | bitOffset (size_t bit) |
static constexpr size_t | blockCount (size_t nbits) |
static void | set (T *p, size_t bit) |
static void | clear (T *p, size_t bit) |
static bool | test (const T *p, size_t bit) |
static void | set (T *p, size_t bitStart, size_t count, UnderlyingType value) |
static UnderlyingType | get (const T *p, size_t bitStart, size_t count) |
static size_t | count (const T *begin, const T *end) |
Static Public Attributes | |
static constexpr size_t | bitsPerBlock |
Private Types | |
using | UnsignedType = typename std::make_unsigned< UnderlyingType >::type |
Static Private Member Functions | |
static void | innerSet (T *p, size_t bitStart, size_t count, UnderlyingType value) |
static UnderlyingType | innerGet (const T *p, size_t bitStart, size_t count) |
static constexpr UnderlyingType | ones (size_t count) |
Static Private Attributes | |
static constexpr UnderlyingType | zero = UnderlyingType(0) |
static constexpr UnderlyingType | one = UnderlyingType(1) |
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)
typedef T folly::Bits< T, Traits >::type |
typedef Traits::UnderlyingType folly::Bits< T, Traits >::UnderlyingType |
|
private |
|
inlinestatic |
|
inlinestatic |
Number of blocks used by the given number of bits.
Definition at line 153 of file Bits.h.
References folly::test::begin(), count, folly::test::end(), folly::T, test(), and folly::value().
|
inlinestatic |
|
inlinestatic |
Clear the given bit.
Definition at line 226 of file Bits.h.
References folly::T.
Referenced by runSimpleTest64(), and runSimpleTest8().
|
inlinestatic |
Count the number of bits set in a range of blocks.
Definition at line 319 of file Bits.h.
References folly::test::begin(), folly::test::end(), deadlock::load(), and folly::popcount().
|
inlinestatic |
Get count contiguous bits starting at bitStart. Precondition: count <= sizeof(T) * 8
Definition at line 285 of file Bits.h.
Referenced by benchmarkGet(), and TEST().
|
inlinestaticprivate |
|
inlinestaticprivate |
Definition at line 265 of file Bits.h.
References FOLLY_POP_WARNING.
|
inlinestaticprivate |
Definition at line 206 of file Bits.h.
References count, FOLLY_GCC_DISABLE_WARNING, FOLLY_GNU_DISABLE_WARNING, and FOLLY_PUSH_WARNING.
|
inlinestatic |
Set the given bit.
Definition at line 220 of file Bits.h.
References folly::T.
Referenced by benchmarkSet(), runMultiBitTest64(), runMultiBitTest8(), runSignedMultiBitTest8(), runSimpleTest64(), runSimpleTest8(), and TEST().
|
inlinestatic |
Set count contiguous bits starting at bitStart to the values from the least significant count bits of value; little endian. (value & 1 becomes the bit at bitStart, etc) Precondition: count <= sizeof(T) * 8 Precondition: value can fit in 'count' bits
Definition at line 232 of file Bits.h.
References count, type, and value.
|
inlinestatic |
|
static |
Number of bits in a block.
|
staticprivate |
|
staticprivate |