diff options
| author | Liam <byteslice@airmail.cc> | 2023-08-12 15:18:55 -0400 |
|---|---|---|
| committer | Liam <byteslice@airmail.cc> | 2023-08-15 17:47:40 -0400 |
| commit | 1cecd1d96aa6e9d78c622d636334c4b17b260149 (patch) | |
| tree | beebc2d0da1fa0678a067de9c12cb7d11c775748 /src/common/alignment.h | |
| parent | c8f0a5a18d824c410fe79f9a2919081993d44e2a (diff) | |
fssystem: rework for yuzu style
Diffstat (limited to 'src/common/alignment.h')
| -rw-r--r-- | src/common/alignment.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/common/alignment.h b/src/common/alignment.h index 0057052af4..fc5c26898a 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); } |
