1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:27:45 +00:00

AK: Move integral log2 and exp to IntegerMath.h

This commit is contained in:
Hendiadyoin1 2022-01-29 16:51:02 +01:00 committed by Brian Gianforcaro
parent f6ddaef8bf
commit fbb798f98c
8 changed files with 20 additions and 16 deletions

View file

@ -295,12 +295,6 @@ constexpr T log2(T x)
return ret;
}
template<Integral T>
constexpr T log2(T x)
{
return x ? (8 * sizeof(T) - 1) - count_leading_zeroes(static_cast<MakeUnsigned<T>>(x)) : 0;
}
template<FloatingPoint T>
constexpr T log10(T x)
{
@ -353,11 +347,7 @@ constexpr T exp2(T exponent)
: "0"(exponent));
return res;
}
template<Integral T>
constexpr T exp2(T exponent)
{
return 1u << exponent;
}
}
using Exponentials::exp;