diff options
author | B. Stack <bgstack15@gmail.com> | 2022-11-22 08:54:34 -0500 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2022-11-22 08:54:34 -0500 |
commit | a034cfca98d4408b175938740628a54f57eb7614 (patch) | |
tree | 501fd78c6276c0be8be8d2c671a58dd0598060b5 /zen/basic_math.h | |
parent | add upstream 11.27 (diff) | |
download | FreeFileSync-a034cfca98d4408b175938740628a54f57eb7614.tar.gz FreeFileSync-a034cfca98d4408b175938740628a54f57eb7614.tar.bz2 FreeFileSync-a034cfca98d4408b175938740628a54f57eb7614.zip |
add upstream 11.2811.28
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 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; |