OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
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
10template<unsigned int base, unsigned int exponent>
11
12struct IntPow
13{
14 constexpr static size_t value = base * IntPow<base, exponent - 1>::value;
15};
16
17template<unsigned int base>
18struct IntPow<base, 0>
19{
20 constexpr static size_t value = 1;
21};
22
23template <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