Set the n least significant bits of x, leaving the others unchanged.

Synopsis

Declared in <folly/lang/Bits.h>

template<typename T>
[[nodiscard]]
constexpr
T
set_n_least_significant_bits(
    T x,
    uint32_t n);
Note

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

Return Value

x with its n least significant bits set.

Note

The return value should not be discarded.

Parameters

Name

Description

x

The value to modify.

n

The number of low bits to set.

Created with MrDocs