summaryrefslogtreecommitdiff
path: root/src/common/alignment.h
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2023-08-12 15:18:55 -0400
committerLiam <byteslice@airmail.cc>2023-08-15 17:47:40 -0400
commit50eee9b2185c59c32fb82cf464230a058edd10ea (patch)
treebeebc2d0da1fa0678a067de9c12cb7d11c775748 /src/common/alignment.h
parent0398b34370f9a6d739e0101378770c7d592a4806 (diff)
fssystem: rework for yuzu style
Diffstat (limited to 'src/common/alignment.h')
-rw-r--r--src/common/alignment.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/common/alignment.h b/src/common/alignment.h
index 0057052af..fc5c26898 100644
--- a/src/common/alignment.h
+++ b/src/common/alignment.h
@@ -12,7 +12,9 @@ namespace Common {
template <typename T>
requires std::is_integral_v<T>
-[[nodiscard]] constexpr T AlignUp(T value, size_t size) {
+[[nodiscard]] constexpr T AlignUp(T value_, size_t size) {
+ using U = typename std::make_unsigned_t<T>;
+ auto value{static_cast<U>(value_)};
auto mod{static_cast<T>(value % size)};
value -= mod;
return static_cast<T>(mod == T{0} ? value : value + size);
@@ -26,7 +28,9 @@ template <typename T>
template <typename T>
requires std::is_integral_v<T>
-[[nodiscard]] constexpr T AlignDown(T value, size_t size) {
+[[nodiscard]] constexpr T AlignDown(T value_, size_t size) {
+ using U = typename std::make_unsigned_t<T>;
+ const auto value{static_cast<U>(value_)};
return static_cast<T>(value - value % size);
}