llvm::has_single_bit

Return true if Value is a non-zero power of two.

Synopsis

Declared in <llvm/ADT/bit.h>

template<typename T>
requires std::is_unsigned_v<T>
[[nodiscard]]
constexpr
bool
has_single_bit(T Value) noexcept;

Return Value

True if Value is a non-zero power of two.

NOTE

The return value should not be discarded.

Parameters

NameDescription
ValueUnsigned value to test.