Kagome
Polkadot Runtime Engine in C++17
math.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_MATH_HPP
7 #define KAGOME_MATH_HPP
8 
9 #include <type_traits>
10 
11 namespace kagome::math {
12 
20  template <size_t X, typename T>
21  inline constexpr T roundUp(T t) {
22  static_assert((X & (X - 1)) == 0, "Must be POW 2!");
23  static_assert(X != 0, "Must not be 0!");
24  return (t + (X - 1)) & ~(X - 1);
25  }
26 
27 } // namespace kagome::math
28 
29 #endif // KAGOME_MATH_HPP
constexpr T roundUp(T t)
Definition: math.hpp:21