add RoundUp

This commit is contained in:
Matthew 2025-08-17 07:59:22 +10:00
parent 62bf563027
commit 2cf29e6b81

8
math.d
View File

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