diff --git a/Source/Core/Common/Align.h b/Source/Core/Common/Align.h index 8e51b8aacc..994e505617 100644 --- a/Source/Core/Common/Align.h +++ b/Source/Core/Common/Align.h @@ -7,12 +7,6 @@ namespace Common { -template -constexpr T AlignUp(T value, size_t size) -{ - static_assert(std::is_unsigned(), "T must be an unsigned value."); - return static_cast(value + (size - value % size) % size); -} template constexpr T AlignDown(T value, size_t size) @@ -21,4 +15,11 @@ constexpr T AlignDown(T value, size_t size) return static_cast(value - value % size); } +template +constexpr T AlignUp(T value, size_t size) +{ + static_assert(std::is_unsigned(), "T must be an unsigned value."); + return AlignDown(static_cast(value + (size - 1)), size); +} + } // namespace Common