diff --git a/src/util/Math.h b/src/util/Math.h index d9cea79..8acef73 100644 --- a/src/util/Math.h +++ b/src/util/Math.h @@ -1,5 +1,6 @@ #pragma once +#include "../Common.h" #include namespace Feather::Math @@ -44,4 +45,12 @@ namespace Feather::Math { return CeilLog2(x) - (IsPowerOf2(x) ? 0 : 1); } -} \ No newline at end of file + + // Divide and round up + template + inline constexpr T CeilDiv(const T a, const T b) + { + return (a / b) + (a % b != 0); + } + +}