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);