aboutsummaryrefslogtreecommitdiff
path: root/src/common/alignment.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-07-11 19:28:09 -0400
committerGitHub <noreply@github.com>2020-07-11 19:28:09 -0400
commit1b617c2e3525d40424c08ccb15d8d60de0cef06e (patch)
treef786a1f9e252b89d04664725c8b30d0c33aaa5e3 /src/common/alignment.h
parentf5c026dd2d77ec707150aeec0c55df744bae6f9b (diff)
Revert "Port citra-emu/citra#5441: "Common: remove a mod from AlignUp""
Diffstat (limited to 'src/common/alignment.h')
-rw-r--r--src/common/alignment.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/common/alignment.h b/src/common/alignment.h
index 516bb26c13..f8c49e0797 100644
--- a/src/common/alignment.h
+++ b/src/common/alignment.h
@@ -11,9 +11,7 @@ namespace Common {
template <typename T>
constexpr T AlignUp(T value, std::size_t size) {
static_assert(std::is_unsigned_v<T>, "T must be an unsigned value.");
- auto mod{value % size};
- value -= mod;
- return static_cast<T>(mod == T{0} ? value : value + size);
+ return static_cast<T>(value + (size - value % size) % size);
}
template <typename T>