diff options
author | B. Stack <bgstack15@gmail.com> | 2025-01-20 19:25:18 -0500 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2025-01-20 19:25:18 -0500 |
commit | de65d3c0295894f8eafc4c7582dfe180dc58c81e (patch) | |
tree | 3ba8ec770b81468ca4ad83d985b991c5f669de22 /zen/basic_math.h | |
parent | add upstream 13.9 (diff) | |
download | FreeFileSync-de65d3c0295894f8eafc4c7582dfe180dc58c81e.tar.gz FreeFileSync-de65d3c0295894f8eafc4c7582dfe180dc58c81e.tar.bz2 FreeFileSync-de65d3c0295894f8eafc4c7582dfe180dc58c81e.zip |
Diffstat (limited to 'zen/basic_math.h')
-rw-r--r-- | zen/basic_math.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/zen/basic_math.h b/zen/basic_math.h index 77ce7b7e..9080d07d 100644 --- a/zen/basic_math.h +++ b/zen/basic_math.h @@ -27,7 +27,7 @@ template <class N, class D> auto intDivCeil (N numerator, D denominator); template <class N, class D> auto intDivFloor(N numerator, D denominator); template <size_t N, class T> -T power(T value); +constexpr T power(T value); double radToDeg(double rad); //convert unit [rad] into [°] double degToRad(double degree); //convert unit [°] into [rad] @@ -207,12 +207,12 @@ namespace { template <size_t N, class T> struct PowerImpl; //let's use non-recursive specializations to help the compiler -template <class T> struct PowerImpl<2, T> { static T result(T value) { return value * value; } }; -template <class T> struct PowerImpl<3, T> { static T result(T value) { return value * value * value; } }; +template <class T> struct PowerImpl<2, T> { static constexpr T result(T value) { return value * value; } }; +template <class T> struct PowerImpl<3, T> { static constexpr T result(T value) { return value * value * value; } }; } template <size_t N, class T> inline -T power(T value) +constexpr T power(T value) { return PowerImpl<N, T>::result(value); } |