summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-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 516bb26c1..f8c49e079 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>