summaryrefslogtreecommitdiff
path: root/zen/basic_math.h
diff options
context:
space:
mode:
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