Math::CeilDiv (divide and round up)
This commit is contained in:
parent
1c55884ddc
commit
55fa33057f
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "../Common.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace Feather::Math
|
||||
|
@ -44,4 +45,12 @@ namespace Feather::Math
|
|||
{
|
||||
return CeilLog2(x) - (IsPowerOf2(x) ? 0 : 1);
|
||||
}
|
||||
|
||||
// Divide and round up
|
||||
template<typename T>
|
||||
inline constexpr T CeilDiv(const T a, const T b)
|
||||
{
|
||||
return (a / b) + (a % b != 0);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue