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

View file

@ -71,7 +71,7 @@ std::vector<u8> DecompressDataLZ4(std::span<const u8> compressed, std::size_t un
return uncompressed;
}
int DecompressLZ4(void* dst, size_t dst_size, const void* src, size_t src_size) {
int DecompressDataLZ4(void* dst, size_t dst_size, const void* src, size_t src_size) {
// This is just a thin wrapper around LZ4.
return LZ4_decompress_safe(reinterpret_cast<const char*>(src), reinterpret_cast<char*>(dst),
static_cast<int>(src_size), static_cast<int>(dst_size));

View file

@ -56,6 +56,6 @@ namespace Common::Compression {
[[nodiscard]] std::vector<u8> DecompressDataLZ4(std::span<const u8> compressed,
std::size_t uncompressed_size);
int DecompressLZ4(void* dst, size_t dst_size, const void* src, size_t src_size);
[[nodiscard]] int DecompressDataLZ4(void* dst, size_t dst_size, const void* src, size_t src_size);
} // namespace Common::Compression