4#ifndef TETL_BIT_BIT_CEIL_HPP
5#define TETL_BIT_BIT_CEIL_HPP
7#include <etl/_bit/bit_width.hpp>
8#include <etl/_concepts/builtin_unsigned_integer.hpp>
9#include <etl/_limits/numeric_limits.hpp>
25template <
etl::builtin_unsigned_integer UInt>
26[[nodiscard]]
constexpr auto bit_ceil(UInt x)
noexcept -> UInt
31 if constexpr (is_same_v<UInt,
decltype(+x)>) {
32 return UInt{1U} << bit_width(UInt{x - 1U});
36 return UInt{1U << (bit_width(UInt{x - 1U}) + o) >> o};
constexpr auto bit_ceil(UInt x) noexcept -> UInt
Calculates the smallest integral power of two that is not smaller than x. If that value is not repres...
Definition bit_ceil.hpp:26
Definition adjacent_find.hpp:9
static constexpr int digits
Definition numeric_limits.hpp:687
Definition numeric_limits.hpp:18