summaryrefslogtreecommitdiff
path: root/zen/basic_math.h
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2020-09-01 00:24:17 +0000
committerB Stack <bgstack15@gmail.com>2020-09-01 00:24:17 +0000
commit5a3f52b016581a6a0cb4513614b6c620d365dde2 (patch)
treeacfdfb3e1046db87040477033fda0df76d92916a /zen/basic_math.h
parentMerge branch '11.0' into 'master' (diff)
parentadd upstream 11.1 (diff)
downloadFreeFileSync-5a3f52b016581a6a0cb4513614b6c620d365dde2.tar.gz
FreeFileSync-5a3f52b016581a6a0cb4513614b6c620d365dde2.tar.bz2
FreeFileSync-5a3f52b016581a6a0cb4513614b6c620d365dde2.zip
Merge branch '11.1' into 'master'11.1
add upstream 11.1 See merge request opensource-tracking/FreeFileSync!25
Diffstat (limited to 'zen/basic_math.h')
-rw-r--r--zen/basic_math.h10
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);
}
bgstack15