Merge branch 'cpp-11' into jgrpp

This commit is contained in:
Jonathan G Rennison
2017-10-05 18:20:54 +01:00
39 changed files with 6320 additions and 298 deletions

View File

@@ -341,6 +341,18 @@ static inline uint CeilDiv(uint a, uint b)
return (a + b - 1) / b;
}
/**
* Computes ceil(a / b) for non-negative a and b (templated).
* @param a Numerator
* @param b Denominator
* @return Quotient, rounded up
*/
template <typename T>
static inline T CeilDivT(T a, T b)
{
return (a + b - 1) / b;
}
/**
* Computes ceil(a / b) * b for non-negative a and b.
* @param a Numerator
@@ -352,6 +364,18 @@ static inline uint Ceil(uint a, uint b)
return CeilDiv(a, b) * b;
}
/**
* Computes ceil(a / b) * b for non-negative a and b (templated).
* @param a Numerator
* @param b Denominator
* @return a rounded up to the nearest multiple of b.
*/
template <typename T>
static inline T CeilT(T a, T b)
{
return CeilDivT<T>(a, b) * b;
}
/**
* Computes round(a / b) for signed a and unsigned b.
* @param a Numerator