From d3be5eef238f9c7303bd4daa0bc1d00d00f924e1 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Fri, 5 Sep 2025 21:27:00 +1000 Subject: [PATCH] [orc-rt] Add [[nodiscard]] attributes to Math.h functions. NFC. --- orc-rt/include/orc-rt/Math.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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;