diff --git a/include/boost/dynamic_bitset/detail/lowest_bit.hpp b/include/boost/dynamic_bitset/detail/lowest_bit.hpp index a2047aa..4ab3d85 100644 --- a/include/boost/dynamic_bitset/detail/lowest_bit.hpp +++ b/include/boost/dynamic_bitset/detail/lowest_bit.hpp @@ -1,7 +1,7 @@ // ----------------------------------------------------------- -// lowest_bit.hpp +// lowest_bit() // -// Position of the lowest bit 'on' +// Position of the lowest bit that is set. // // Copyright (c) 2003-2004, 2008, 2025 Gennaro Prota // @@ -20,20 +20,19 @@ namespace boost { namespace detail { - template - int lowest_bit(T x) { +template +int +lowest_bit(T x) +{ + BOOST_ASSERT(x >= 1); - BOOST_ASSERT(x >= 1); - - // clear all bits on except the rightmost one, - // then calculate the logarithm base 2 - // - return boost::integer_log2( x - ( x & (x-1) ) ); - - } + // Clear all the bits that are set except the rightmost one, + // then calculate the logarithm to base 2. + // + return boost::integer_log2(x - (x & (x - 1))); +} } } - #endif // include guard