diff options
author | bunnei <bunneidev@gmail.com> | 2021-05-25 03:50:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-25 03:50:26 +0200 |
commit | d84a93c9874dadfb5b564bc4713ca559d30e4318 (patch) | |
tree | fd8a5f149ff5c5f1a5c02187748b21634095b3ac /src/common | |
parent | Merge pull request #6312 from german77/analogMapping (diff) | |
parent | zstd_compression: Make use of std::span (diff) | |
download | yuzu-d84a93c9874dadfb5b564bc4713ca559d30e4318.tar yuzu-d84a93c9874dadfb5b564bc4713ca559d30e4318.tar.gz yuzu-d84a93c9874dadfb5b564bc4713ca559d30e4318.tar.bz2 yuzu-d84a93c9874dadfb5b564bc4713ca559d30e4318.tar.lz yuzu-d84a93c9874dadfb5b564bc4713ca559d30e4318.tar.xz yuzu-d84a93c9874dadfb5b564bc4713ca559d30e4318.tar.zst yuzu-d84a93c9874dadfb5b564bc4713ca559d30e4318.zip |
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/lz4_compression.cpp | 3 | ||||
-rw-r--r-- | src/common/lz4_compression.h | 5 | ||||
-rw-r--r-- | src/common/zstd_compression.cpp | 2 | ||||
-rw-r--r-- | src/common/zstd_compression.h | 5 |
4 files changed, 8 insertions, 7 deletions
diff --git a/src/common/lz4_compression.cpp b/src/common/lz4_compression.cpp index 25700015a..dbb40da7c 100644 --- a/src/common/lz4_compression.cpp +++ b/src/common/lz4_compression.cpp @@ -59,8 +59,7 @@ std::vector<u8> CompressDataLZ4HCMax(const u8* source, std::size_t source_size) return CompressDataLZ4HC(source, source_size, LZ4HC_CLEVEL_MAX); } -std::vector<u8> DecompressDataLZ4(const std::vector<u8>& compressed, - std::size_t uncompressed_size) { +std::vector<u8> DecompressDataLZ4(std::span<const u8> compressed, std::size_t uncompressed_size) { std::vector<u8> uncompressed(uncompressed_size); const int size_check = LZ4_decompress_safe(reinterpret_cast<const char*>(compressed.data()), reinterpret_cast<char*>(uncompressed.data()), diff --git a/src/common/lz4_compression.h b/src/common/lz4_compression.h index 87a4be1b0..1b4717595 100644 --- a/src/common/lz4_compression.h +++ b/src/common/lz4_compression.h @@ -4,6 +4,7 @@ #pragma once +#include <span> #include <vector> #include "common/common_types.h" @@ -53,7 +54,7 @@ namespace Common::Compression { * * @return the decompressed data. */ -[[nodiscard]] std::vector<u8> DecompressDataLZ4(const std::vector<u8>& compressed, +[[nodiscard]] std::vector<u8> DecompressDataLZ4(std::span<const u8> compressed, std::size_t uncompressed_size); -} // namespace Common::Compression
\ No newline at end of file +} // namespace Common::Compression diff --git a/src/common/zstd_compression.cpp b/src/common/zstd_compression.cpp index 5f45459da..695b96a43 100644 --- a/src/common/zstd_compression.cpp +++ b/src/common/zstd_compression.cpp @@ -32,7 +32,7 @@ std::vector<u8> CompressDataZSTDDefault(const u8* source, std::size_t source_siz return CompressDataZSTD(source, source_size, ZSTD_CLEVEL_DEFAULT); } -std::vector<u8> DecompressDataZSTD(const std::vector<u8>& compressed) { +std::vector<u8> DecompressDataZSTD(std::span<const u8> compressed) { const std::size_t decompressed_size = ZSTD_getDecompressedSize(compressed.data(), compressed.size()); std::vector<u8> decompressed(decompressed_size); diff --git a/src/common/zstd_compression.h b/src/common/zstd_compression.h index c26a30ab9..bbce14f4e 100644 --- a/src/common/zstd_compression.h +++ b/src/common/zstd_compression.h @@ -4,6 +4,7 @@ #pragma once +#include <span> #include <vector> #include "common/common_types.h" @@ -40,6 +41,6 @@ namespace Common::Compression { * * @return the decompressed data. */ -[[nodiscard]] std::vector<u8> DecompressDataZSTD(const std::vector<u8>& compressed); +[[nodiscard]] std::vector<u8> DecompressDataZSTD(std::span<const u8> compressed); -} // namespace Common::Compression
\ No newline at end of file +} // namespace Common::Compression |