mirror of
https://github.com/boostorg/core.git
synced 2025-07-30 12:57:26 +02:00
🐛 Fix bit_ceil() to return 1 for input 0 as per specification
This commit is contained in:
@ -703,7 +703,7 @@ BOOST_CXX14_CONSTEXPR inline boost::uint32_t bit_ceil_impl( boost::uint32_t x )
|
|||||||
{
|
{
|
||||||
if( x == 0 )
|
if( x == 0 )
|
||||||
{
|
{
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
--x;
|
--x;
|
||||||
@ -723,7 +723,7 @@ BOOST_CXX14_CONSTEXPR inline boost::uint64_t bit_ceil_impl( boost::uint64_t x )
|
|||||||
{
|
{
|
||||||
if( x == 0 )
|
if( x == 0 )
|
||||||
{
|
{
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
--x;
|
--x;
|
||||||
|
@ -21,7 +21,7 @@ template<class T> void test_bit_ceil( T x )
|
|||||||
|
|
||||||
if( x == 0 )
|
if( x == 0 )
|
||||||
{
|
{
|
||||||
BOOST_TEST_EQ( y, 0 );
|
BOOST_TEST_EQ( y, 1 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user