1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-29 12:17:36 +00:00

AK: Use correct type when calculating integral exp2()

Previously, integral `exp2()` would produce the incorrect result for
exponents above 31.
This commit is contained in:
Tim Ledbetter 2023-10-27 22:02:18 +01:00 committed by Tim Flynn
parent 810bbeaed1
commit e4715aa82a
2 changed files with 19 additions and 1 deletions

View file

@ -15,7 +15,7 @@ namespace AK {
template<Integral T>
constexpr T exp2(T exponent)
{
return 1u << exponent;
return static_cast<T>(1) << exponent;
}
template<Integral T>