From 2cf29e6b81d5dd4809775ea1498d01bd1928d801 Mon Sep 17 00:00:00 2001 From: Matthew Date: Sun, 17 Aug 2025 07:59:22 +1000 Subject: [PATCH] add RoundUp --- math.d | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/math.d b/math.d index 8bf5cb9..a4b4d12 100644 --- a/math.d +++ b/math.d @@ -9,6 +9,14 @@ import std.meta; import std.format; import std.stdio; +T +RoundUp(T a, T b) +{ + a += b - 1; + a -= a%b; + return a; +} + T AlignPow2(T)(T v, T a) { return (v + a - 1) & ~(a - 1);