diff options
author | Daniel Wilhelm <shieldwed@outlook.com> | 2018-06-30 12:43:08 +0200 |
---|---|---|
committer | Daniel Wilhelm <shieldwed@outlook.com> | 2018-06-30 12:43:08 +0200 |
commit | a98326eb2954ac1e79f5eac28dbeab3ec15e047f (patch) | |
tree | bb16257a1894b488e365851273735ec13a9442ef /zen/basic_math.h | |
parent | 10.0 (diff) | |
download | FreeFileSync-a98326eb2954ac1e79f5eac28dbeab3ec15e047f.tar.gz FreeFileSync-a98326eb2954ac1e79f5eac28dbeab3ec15e047f.tar.bz2 FreeFileSync-a98326eb2954ac1e79f5eac28dbeab3ec15e047f.zip |
10.1
Diffstat (limited to 'zen/basic_math.h')
-rwxr-xr-x | zen/basic_math.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/zen/basic_math.h b/zen/basic_math.h index 16f69bde..0d08f6a6 100755 --- a/zen/basic_math.h +++ b/zen/basic_math.h @@ -13,6 +13,7 @@ #include <cmath> #include <functional> #include <cassert> +#include "type_traits.h" namespace numeric @@ -65,6 +66,7 @@ const double sqrt2 = 1.41421356237309504880; const double ln2 = 0.693147180559945309417; //static_assert(pi + e + sqrt2 + ln2 == 7.9672352249818781, "whoopsie"); + //---------------------------------------------------------------------------------- @@ -83,7 +85,7 @@ const double ln2 = 0.693147180559945309417; template <class T> inline T abs(T value) { - //static_assert(std::is_signed<T>::value, ""); + //static_assert(std::is_signed_v<T>); if (value < 0) return -value; //operator "?:" caveat: may be different type than "value" else @@ -100,7 +102,7 @@ auto dist(T a, T b) //return type might be different than T, e.g. std::chrono::d template <class T> inline int sign(T value) //returns one of {-1, 0, 1} { - static_assert(std::is_signed<T>::value, ""); + static_assert(std::is_signed_v<T>); return value < 0 ? -1 : (value > 0 ? 1 : 0); } @@ -231,8 +233,8 @@ int64_t round(double d) template <class N, class D> inline auto integerDivideRoundUp(N numerator, D denominator) { - static_assert(std::is_integral<N>::value, ""); - static_assert(std::is_integral<D>::value, ""); + static_assert(zen::IsInteger<N>::value); + static_assert(zen::IsInteger<D>::value); assert(numerator > 0 && denominator > 0); return (numerator + denominator - 1) / denominator; } |