1
0
mirror of https://github.com/SerenityOS/serenity synced 2024-07-01 11:19:21 +00:00

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

View File

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