summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/math_func.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/math_func.hpp b/src/core/math_func.hpp
index 92893ed31..42c41abad 100644
--- a/src/core/math_func.hpp
+++ b/src/core/math_func.hpp
@@ -330,6 +330,17 @@ static FORCEINLINE uint CeilDiv(uint a, uint b)
}
/**
+ * Computes ceil(a / b) * b for non-negative a and b.
+ * @param a Numerator
+ * @param b Denominator
+ * @return a rounded up to the nearest multiple of b.
+ */
+static FORCEINLINE uint Ceil(uint a, uint b)
+{
+ return CeilDiv(a, b) * b;
+}
+
+/**
* Computes round(a / b) for signed a and unsigned b.
* @param a Numerator
* @param b Denominator