OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
mathUtils.hpp
1 //
2 // Created by tommaso on 28/06/19.
3 //
4 
5 #ifndef OPENFPM_PDATA_MATHUTILS_HPP
6 #define OPENFPM_PDATA_MATHUTILS_HPP
7 
8 #include <cstdlib>
9 
10 template<unsigned int base, unsigned int exponent>
11 
12 struct IntPow
13 {
14  constexpr static size_t value = base * IntPow<base, exponent - 1>::value;
15 };
16 
17 template<unsigned int base>
18 struct IntPow<base, 0>
19 {
20  constexpr static size_t value = 1;
21 };
22 
23 template <unsigned int numerator, unsigned int denominator>
25 {
26  constexpr static unsigned int value = numerator / denominator + (numerator%denominator!=0);
27 };
28 
29 #endif //OPENFPM_PDATA_MATHUTILS_HPP