CppCommon  1.0.4.1
C++ Common Library
math.h
Go to the documentation of this file.
1 
9 #ifndef CPPCOMMON_MATH_MATH_H
10 #define CPPCOMMON_MATH_MATH_H
11 
12 #include <cstdint>
13 
14 namespace CppCommon {
15 
17 
22 class Math
23 {
24 public:
25  Math() = delete;
26  Math(const Math&) = delete;
27  Math(Math&&) = delete;
28  ~Math() = delete;
29 
30  Math& operator=(const Math&) = delete;
31  Math& operator=(Math&&) = delete;
32 
34 
39  template <typename T>
40  static T GCD(T a, T b);
41 
43 
48  template <typename T>
49  static T RoundUp(T a, T k);
50 
52 
58  static uint64_t MulDiv64(uint64_t operant, uint64_t multiplier, uint64_t divider);
59 };
60 
63 } // namespace CppCommon
64 
65 #include "math.inl"
66 
67 #endif // CPPCOMMON_MATH_MATH_H
Math static class.
Definition: math.h:23
static uint64_t MulDiv64(uint64_t operant, uint64_t multiplier, uint64_t divider)
Calculate (operant * multiplier / divider) with 64-bit unsigned integer values.
Definition: math.cpp:17
static T GCD(T a, T b)
Computes the greatest common divisor of a and b.
Math & operator=(const Math &)=delete
Math(Math &&)=delete
Math & operator=(Math &&)=delete
static T RoundUp(T a, T k)
Finds the smallest value x >= a such that x % k == 0.
Definition: math.inl:27
Math(const Math &)=delete
Math inline implementation.
C++ Common project definitions.
Definition: token_bucket.h:15