fssystem: rework for yuzu style

This commit is contained in:
Liam 2023-08-12 15:18:55 -04:00
parent 0398b34370
commit 50eee9b218
34 changed files with 344 additions and 339 deletions

View file

@ -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);
}