mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-27 07:14:23 +01:00
lz4_compression: Make use of std::span
Allows making the incoming data stream non-allocating.
This commit is contained in:
parent
5068279f23
commit
00213377b1
@ -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()),
|
||||
|
@ -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
|
||||
} // namespace Common::Compression
|
||||
|
Loading…
Reference in New Issue
Block a user