Difference between revisions of "cpp/numeric/bit ceil"
From cppreference.com
m |
m |
||
Line 8: | Line 8: | ||
Calculates the smallest integral power of two that is not smaller than {{tt|x}}. If that value is not representable in {{tt|T}}, the result is unspecified. | Calculates the smallest integral power of two that is not smaller than {{tt|x}}. If that value is not representable in {{tt|T}}, the result is unspecified. | ||
− | {{cpp/enable_if|{{tt|T}} is an unsigned integer type (that is, {{c|unsigned char}}, {{c|unsigned short}}, {{c|unsigned int}}, {{c|unsigned long}}, {{c|unsigned long long}}, or an extended unsigned integer type}}. | + | {{cpp/enable_if|{{tt|T}} is an unsigned integer type (that is, {{c|unsigned char}}, {{c|unsigned short}}, {{c|unsigned int}}, {{c|unsigned long}}, {{c|unsigned long long}}, or an extended unsigned integer type)}}. |
=== Return value === | === Return value === |
Revision as of 00:55, 18 June 2018
Defined in header <bit>
|
||
template< class T > constexpr T ceil2(T x) noexcept; |
(since C++20) | |
Calculates the smallest integral power of two that is not smaller than x
. If that value is not representable in T
, the result is unspecified.
This overload participates in overload resolution only if T
is an unsigned integer type (that is, unsigned char, unsigned short, unsigned int, unsigned long, unsigned long long, or an extended unsigned integer type).
Return value
The smallest integral power of two that is not smaller than x
, or an unspecified value if the result cannot be represented in T
.
Example
This section is incomplete Reason: no example |