diff --git a/include/intx/intx.hpp b/include/intx/intx.hpp index bd3b8455..7886d639 100644 --- a/include/intx/intx.hpp +++ b/include/intx/intx.hpp @@ -593,6 +593,9 @@ template constexpr uint exp(uint base, uint exponent) noexcept { auto result = uint{1}; + if (base == 2) + return result << exponent; + while (exponent != 0) { if ((exponent & 1) != 0)