BloombergLP::bdlb::BitStringUtil::insert

Insert bits of a given value into a bit string.

Synopsis

Declared in <bdlb_bitstringutil.h>

static
void
insert(
    uint64_t* bitString,
    std::size_t initialLength,
    std::size_t dstIndex,
    bool value,
    std::size_t numBits);

Description

Insert the specified numBits, each having the specified value, into the specified bitString having the specified initialLength, beginning at the specified dstIndex. Bits at or above dstIndex are shifted up by numBits index positions and the length of bitString is increased by numBits. The behavior is undefined unless dstIndex <= initialLength and bitString has a capacity of at least initialLength + numBits.

Parameters

NameDescription
bitStringbit string to modify
initialLengthlength of bitString before insertion
dstIndexbit position at which to insert
valuevalue of each inserted bit
numBitsnumber of bits to insert