]> git.localhorst.tv Git - l2e.git/blob - src/math/utility.h
added fixed point number type
[l2e.git] / src / math / utility.h
1 #ifndef MATH_UTILITY_H_
2 #define MATH_UTILITY_H_
3
4
5 namespace math {
6
7 template<class Int>
8 Int DistanceShift(Int what, int lhs, int rhs) {
9         if (lhs < rhs) {
10                 return what >> (rhs - lhs);
11         } else {
12                 return what << (lhs - rhs);
13         }
14 }
15
16 }
17
18 #endif