CppCommon  1.0.4.1
C++ Common Library
math.inl
Go to the documentation of this file.
1 
9 namespace CppCommon {
10 
11 template <typename T>
12 inline T GCD(T a, T b)
13 {
14  T c = a % b;
15 
16  while (c != 0)
17  {
18  a = b;
19  b = c;
20  c = a % b;
21  }
22 
23  return b;
24 }
25 
26 template <typename T>
27 inline T Math::RoundUp(T a, T k)
28 {
29  return ((a + k - 1) / k) * k;
30 }
31 
32 } // namespace CppCommon
static T RoundUp(T a, T k)
Finds the smallest value x >= a such that x % k == 0.
Definition: math.inl:27
C++ Common project definitions.
Definition: token_bucket.h:15
T GCD(T a, T b)
Definition: math.inl:12