From 28cb217ac353b39adef56ee1a24fece5d1398e37 Mon Sep 17 00:00:00 2001 From: "Ding, Zhehang" Date: Tue, 31 Mar 2026 16:56:55 +0800 Subject: [PATCH] Mark template function in math_funcs_binary constexpr --- core/math/math_funcs_binary.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/math/math_funcs_binary.h b/core/math/math_funcs_binary.h index 2e9a13853a..f4da5097e9 100644 --- a/core/math/math_funcs_binary.h +++ b/core/math/math_funcs_binary.h @@ -38,7 +38,7 @@ namespace Math { // Returns `true` if a positive integer is a power of 2, `false` otherwise. template -inline bool is_power_of_2(const T x) { +constexpr bool is_power_of_2(const T x) { return x && ((x & (x - 1)) == 0); } @@ -129,7 +129,7 @@ constexpr int32_t get_shift_from_power_of_2(uint32_t p_bits) { } template -_FORCE_INLINE_ T nearest_power_of_2_templated(T p_number) { +constexpr T nearest_power_of_2_templated(T p_number) { --p_number; // The number of operations on x is the base two logarithm