folly::n_most_significant_bits

Return a value of type T with the n most significant bits set.

Synopsis

Declared in <folly/lang/Bits.h>

template<class T>
[[nodiscard]]
constexpr
T
n_most_significant_bits(uint32_t n);

NOTE

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

Return Value

A value with n most significant bits set and the rest cleared.

NOTE

The return value should not be discarded.

Parameters

NameDescription
nThe number of high bits to set.