BloombergLP::bdlb::BitUtil::withBitSet

Return value with the bit at index set.

Synopsis

Declared in <bdlb_bitutil.h>

static
unsigned int
withBitSet(
    unsigned int value,
    int index);

Description

Return the result of replacing the bit at the specified index in the specified value with 1, transferring all other bits from value unchanged. The behavior is undefined unless 0 <= index < sizeInBits(value).

Return Value

value with the bit at index set

Parameters

NameDescription
valuevalue to modify
indexbit position to set