diff --git a/orc-rt/include/orc-rt/Math.h b/orc-rt/include/orc-rt/Math.h index 7d5dfbe7e0763..625aee08f7f89 100644 --- a/orc-rt/include/orc-rt/Math.h +++ b/orc-rt/include/orc-rt/Math.h @@ -19,12 +19,12 @@ namespace orc_rt { /// Test whether the given value is a power of 2. -template constexpr bool isPowerOf2(T Val) noexcept { +template [[nodiscard]] constexpr bool isPowerOf2(T Val) noexcept { return Val != 0 && (Val & (Val - 1)) == 0; } /// Calculates the next power of 2. -template constexpr T nextPowerOf2(T Val) noexcept { +template [[nodiscard]] constexpr T nextPowerOf2(T Val) noexcept { for (std::size_t I = 1; I < std::numeric_limits::digits; I <<= 1) Val |= (Val >> I); return Val + 1;