diff --git a/AK/Math.h b/AK/Math.h index ed6d91c367..469cc7e5ec 100644 --- a/AK/Math.h +++ b/AK/Math.h @@ -298,7 +298,7 @@ constexpr T log2(T x) template constexpr T log2(T x) { - return x ? 8 * sizeof(T) - count_leading_zeroes(static_cast>(x)) : 0; + return x ? (8 * sizeof(T) - 1) - count_leading_zeroes(static_cast>(x)) : 0; } template