summaryrefslogtreecommitdiff
path: root/src/common/alignment.h
diff options
context:
space:
mode:
authorGravatar bunnei2020-07-11 14:54:34 -0400
committerGravatar GitHub2020-07-11 14:54:34 -0400
commit7a051c497386e443d5d2a5f3e3493d734d963687 (patch)
treecbd176cf7b3dd85cde0b8fb65f8df38727d1c9a5 /src/common/alignment.h
parentMerge pull request #4203 from VolcaEM/services (diff)
parentCommon: remove a mod from AlignUp (#5441) (diff)
downloadyuzu-7a051c497386e443d5d2a5f3e3493d734d963687.tar.gz
yuzu-7a051c497386e443d5d2a5f3e3493d734d963687.tar.xz
yuzu-7a051c497386e443d5d2a5f3e3493d734d963687.zip
Merge pull request #4300 from FearlessTobi/port-5441
Port citra-emu/citra#5441: "Common: remove a mod from AlignUp"
Diffstat (limited to '')
-rw-r--r--src/common/alignment.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/common/alignment.h b/src/common/alignment.h
index f8c49e079..516bb26c1 100644
--- a/src/common/alignment.h
+++ b/src/common/alignment.h
@@ -11,7 +11,9 @@ namespace Common {
11template <typename T> 11template <typename T>
12constexpr T AlignUp(T value, std::size_t size) { 12constexpr T AlignUp(T value, std::size_t size) {
13 static_assert(std::is_unsigned_v<T>, "T must be an unsigned value."); 13 static_assert(std::is_unsigned_v<T>, "T must be an unsigned value.");
14 return static_cast<T>(value + (size - value % size) % size); 14 auto mod{value % size};
15 value -= mod;
16 return static_cast<T>(mod == T{0} ? value : value + size);
15} 17}
16 18
17template <typename T> 19template <typename T>