C++ Utils  0.1
utils/mathutils.h
Go to the documentation of this file.
00001 
00036 #ifndef UTILS_MATHUTILS_H
00037 #define UTILS_MATHUTILS_H
00038 
00039 namespace utils
00040 {
00041 
00045 class MathUtils
00046 {
00047 public:
00053         template<typename T>
00054         static T roundUp(T a, T k)
00055         {
00056                 return ((a + k - 1) / k) * k;
00057         }
00058 
00066         template<typename T>
00067         static T gcd(T a, T b)
00068         {
00069                 T c = a % b;
00070                 while(c != 0) {
00071                         a = b;
00072                         b = c;
00073                         c = a % b;
00074                 }
00075                 return b;
00076         }
00077 };
00078 
00079 }
00080 
00081 #endif // UTILS_ARGS_H
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines