diff options
author | B Stack <bgstack15@gmail.com> | 2020-08-31 20:07:13 -0400 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2020-08-31 20:07:13 -0400 |
commit | 8a27fa9c617533e76673ce61a65e2ba869b52208 (patch) | |
tree | acfdfb3e1046db87040477033fda0df76d92916a /zen/basic_math.h | |
parent | Merge branch '11.0' into 'master' (diff) | |
download | FreeFileSync-8a27fa9c617533e76673ce61a65e2ba869b52208.tar.gz FreeFileSync-8a27fa9c617533e76673ce61a65e2ba869b52208.tar.bz2 FreeFileSync-8a27fa9c617533e76673ce61a65e2ba869b52208.zip |
add upstream 11.1
Diffstat (limited to 'zen/basic_math.h')
-rw-r--r-- | zen/basic_math.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/zen/basic_math.h b/zen/basic_math.h index 0a226555..0e30c276 100644 --- a/zen/basic_math.h +++ b/zen/basic_math.h @@ -7,14 +7,11 @@ #ifndef BASIC_MATH_H_3472639843265675 #define BASIC_MATH_H_3472639843265675 +#include <cassert> #include <algorithm> -#include <iterator> -#include <limits> #include <cmath> -#include <functional> -#include <cassert> + #include <numbers> #include "type_traits.h" -#include "legacy_compiler.h" namespace numeric @@ -22,7 +19,7 @@ namespace numeric template <class T> T abs(T value); template <class T> auto dist(T a, T b); template <class T> int sign(T value); //returns one of {-1, 0, 1} -template <class T> bool isNull(T value); +template <class T> bool isNull(T value); //...definitively fishy... template <class T, class InputIterator> //precondition: range must be sorted! auto nearMatch(const T& val, InputIterator first, InputIterator last); @@ -168,6 +165,7 @@ int64_t round(double d) { assert(d - 0.5 >= std::numeric_limits<int64_t>::min() && //if double is larger than what int can represent: d + 0.5 <= std::numeric_limits<int64_t>::max()); //=> undefined behavior! + return static_cast<int64_t>(d < 0 ? d - 0.5 : d + 0.5); } |