1#pragma once
2
3#include <cmath>
4
5namespace mbgl {
6namespace util {
7
8// Constrains n to the given range (including min, excluding max) via modular
9// arithmetic.
10template <typename T>
11T wrap(T value, T min, T max) {
12 T d = max - min;
13 return std::fmod((std::fmod((value - min), d) + d), d) + min;
14}
15
16} // namespace util
17} // namespace mbgl
18

source code of qtlocation/src/3rdparty/mapbox-gl-native/include/mbgl/math/wrap.hpp