summaryrefslogtreecommitdiff
path: root/include/mbgl/math/wrap.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/mbgl/math/wrap.hpp')
-rw-r--r--include/mbgl/math/wrap.hpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/mbgl/math/wrap.hpp b/include/mbgl/math/wrap.hpp
index 16dc598c22..8a9303edc2 100644
--- a/include/mbgl/math/wrap.hpp
+++ b/include/mbgl/math/wrap.hpp
@@ -9,6 +9,11 @@ namespace util {
// arithmetic.
template <typename T>
T wrap(T value, T min, T max) {
+ if (value >= min && value < max) {
+ return value;
+ } else if (value == max) {
+ return min;
+ }
T d = max - min;
return std::fmod((std::fmod((value - min), d) + d), d) + min;
}