From a87502c04f514b249d594deeb8ca74c3ef8f9361 Mon Sep 17 00:00:00 2001 From: Gennaro Prota Date: Sun, 22 Jun 2025 09:54:51 +0200 Subject: [PATCH] Clean up detail/lowest_bit.hpp (mostly, reformat) --- .../dynamic_bitset/detail/lowest_bit.hpp | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) 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