Skip to content

Commit 4a919ad

Browse files
committed
Merge pull request godotengine#118027 from zhehangd/constexpr_math_funcs_binary
Mark template function in math_funcs_binary constexpr
2 parents 777b5f6 + 28cb217 commit 4a919ad

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

core/math/math_funcs_binary.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace Math {
3838

3939
// Returns `true` if a positive integer is a power of 2, `false` otherwise.
4040
template <typename T>
41-
inline bool is_power_of_2(const T x) {
41+
constexpr bool is_power_of_2(const T x) {
4242
return x && ((x & (x - 1)) == 0);
4343
}
4444

@@ -129,7 +129,7 @@ constexpr int32_t get_shift_from_power_of_2(uint32_t p_bits) {
129129
}
130130

131131
template <typename T>
132-
_FORCE_INLINE_ T nearest_power_of_2_templated(T p_number) {
132+
constexpr T nearest_power_of_2_templated(T p_number) {
133133
--p_number;
134134

135135
// The number of operations on x is the base two logarithm

0 commit comments

Comments
 (0)