37 lines
1,006 B
C++
37 lines
1,006 B
C++
#ifndef D6937363_A08A_40BF_B387_36E8AC570ECF
|
|
#define D6937363_A08A_40BF_B387_36E8AC570ECF
|
|
/*
|
|
*******************************************************************************
|
|
* INCLUDE
|
|
*******************************************************************************
|
|
*/
|
|
|
|
namespace Util
|
|
{
|
|
/*
|
|
*******************************************************************************
|
|
* CLASS DECLARE
|
|
*******************************************************************************
|
|
*/
|
|
class Math
|
|
{
|
|
public:
|
|
static unsigned alignup(unsigned num, unsigned align);
|
|
static unsigned aligndown(unsigned num, unsigned align);
|
|
|
|
template <typename T> static T max(T a, T b)
|
|
{
|
|
return a > b ? a : b;
|
|
}
|
|
template <typename T> static T min(T a, T b)
|
|
{
|
|
return a < b ? a : b;
|
|
}
|
|
|
|
template <typename T> static T clamp(T value, T minVal, T maxVal)
|
|
{
|
|
return max(minVal, min(maxVal, value));
|
|
}
|
|
};
|
|
}
|
|
#endif
|