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