Merge pull request #199 from Pega5us/fix-issue#197-bitceil

🐛 Fix bit_ceil() to return 1 for input 0 as per specification
This commit is contained in:
Peter Dimov
2025-06-06 18:17:15 +03:00
committed by GitHub
2 changed files with 3 additions and 3 deletions

View File

@ -703,7 +703,7 @@ BOOST_CXX14_CONSTEXPR inline boost::uint32_t bit_ceil_impl( boost::uint32_t x )
{
if( x == 0 )
{
return 0;
return 1;
}
--x;
@ -723,7 +723,7 @@ BOOST_CXX14_CONSTEXPR inline boost::uint64_t bit_ceil_impl( boost::uint64_t x )
{
if( x == 0 )
{
return 0;
return 1;
}
--x;

View File

@ -21,7 +21,7 @@ template<class T> void test_bit_ceil( T x )
if( x == 0 )
{
BOOST_TEST_EQ( y, 0 );
BOOST_TEST_EQ( y, 1 );
}
else
{