CppCommon 1.0.5.0
C++ Common Library
Loading...
Searching...
No Matches
math.inl
Go to the documentation of this file.
1
9namespace CppCommon {
10
11template <typename T>
12inline 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
26template <typename T>
27inline 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.
T GCD(T a, T b)
Definition math.inl:12