llvm::bit_ceil_constexpr

Returns the smallest integral power of two no smaller than Value if Value is nonzero. Returns 1 otherwise.

Synopsis

Declared in <llvm/ADT/bit.h>

template<typename T>
[[nodiscard]]
constexpr
T
bit_ceil_constexpr(T Value);

Description

Ex. bit_ceil(5) == 8.

The return value is undefined if the input is larger than the largest power of two representable in T.

Return Value

Smallest power of two ≥ Value, or 1 if Value is less than 2.

NOTE

The return value should not be discarded.

Parameters

NameDescription
ValueUnsigned value to ceil to a power of two.