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]]
T
bit_ceil(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

Name

Description

Value

Unsigned value to ceil to a power of two.

Created with MrDocs