summaryrefslogtreecommitdiff
path: root/zen/basic_math.h
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2022-11-22 08:54:34 -0500
committerB. Stack <bgstack15@gmail.com>2022-11-22 08:54:34 -0500
commita034cfca98d4408b175938740628a54f57eb7614 (patch)
tree501fd78c6276c0be8be8d2c671a58dd0598060b5 /zen/basic_math.h
parentadd upstream 11.27 (diff)
downloadFreeFileSync-11.28.tar.gz
FreeFileSync-11.28.tar.bz2
FreeFileSync-11.28.zip
add upstream 11.2811.28
Diffstat (limited to 'zen/basic_math.h')
-rw-r--r--zen/basic_math.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/zen/basic_math.h b/zen/basic_math.h
index c8a06b78..7258128f 100644
--- a/zen/basic_math.h
+++ b/zen/basic_math.h
@@ -20,7 +20,7 @@ template <class T> int sign(T value); //returns one of {-1, 0, 1}
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);
+auto roundToGrid(T val, InputIterator first, InputIterator last);
template <class N, class D> auto intDivRound(N numerator, D denominator);
template <class N, class D> auto intDivCeil (N numerator, D denominator);
@@ -122,12 +122,12 @@ std::pair<InputIterator, InputIterator> minMaxElement(InputIterator first, Input
*/
template <class T, class InputIterator> inline
-auto nearMatch(const T& val, InputIterator first, InputIterator last)
+auto roundToGrid(T val, InputIterator first, InputIterator last)
{
+ assert(std::is_sorted(first, last));
if (first == last)
- return static_cast<decltype(*first)>(0);
+ return static_cast<decltype(*first)>(val);
- assert(std::is_sorted(first, last));
InputIterator it = std::lower_bound(first, last, val);
if (it == last)
return *--last;
bgstack15