AK: Fix doc comment for bit_scan_forward

The original doc comment was mistakenly copy-pasted from
count_leading_zeroes_safe, and incorrect. The function is doing
something else: it's counting _trailing_ zeroes instead of _leading_
ones.
This commit is contained in:
Martin Janiczek 2023-10-11 17:22:43 +02:00 committed by Tim Flynn
parent a673062084
commit de73572b3d
Notes: sideshowbarker 2024-07-16 23:34:44 +09:00

View file

@ -128,9 +128,10 @@ inline constexpr int count_leading_zeroes_safe(IntType value)
return count_leading_zeroes(value); return count_leading_zeroes(value);
} }
// The function will return the number of leading zeroes in the type. If // Returns one plus the index of the least significant 1-bit of x, or if x is
// the given number is zero, this function will return the number of bits // zero, returns zero. (See __builtin_ffs.)
// in the IntType. //
// For numbers above zero, bit_scan_forward(n) == count_trailing_zeroes(n) + 1.
template<Integral IntType> template<Integral IntType>
inline constexpr int bit_scan_forward(IntType value) inline constexpr int bit_scan_forward(IntType value)
{ {