summaryrefslogtreecommitdiff
path: root/src/common/zstd_compression.h
diff options
context:
space:
mode:
authorGravatar Lioncash2020-07-25 03:11:14 -0400
committerGravatar Lioncash2020-07-25 03:11:56 -0400
commitc5bdccfecb279ba581e5931f7fd9678d1aaa8f85 (patch)
tree8d12aff0d6624729521ea9a5950308fd2731aa18 /src/common/zstd_compression.h
parentMerge pull request #4383 from ogniK5377/dark-checkbox (diff)
downloadyuzu-c5bdccfecb279ba581e5931f7fd9678d1aaa8f85.tar.gz
yuzu-c5bdccfecb279ba581e5931f7fd9678d1aaa8f85.tar.xz
yuzu-c5bdccfecb279ba581e5931f7fd9678d1aaa8f85.zip
zstd_compression: Make use of std::span in interfaces
Allows condensing the data and size parameters into a single argument.
Diffstat (limited to 'src/common/zstd_compression.h')
-rw-r--r--src/common/zstd_compression.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/common/zstd_compression.h b/src/common/zstd_compression.h
index e9de941c8..b5edf19e7 100644
--- a/src/common/zstd_compression.h
+++ b/src/common/zstd_compression.h
@@ -4,6 +4,7 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <span>
7#include <vector> 8#include <vector>
8 9
9#include "common/common_types.h" 10#include "common/common_types.h"
@@ -14,23 +15,21 @@ namespace Common::Compression {
14 * Compresses a source memory region with Zstandard and returns the compressed data in a vector. 15 * Compresses a source memory region with Zstandard and returns the compressed data in a vector.
15 * 16 *
16 * @param source the uncompressed source memory region. 17 * @param source the uncompressed source memory region.
17 * @param source_size the size in bytes of the uncompressed source memory region.
18 * @param compression_level the used compression level. Should be between 1 and 22. 18 * @param compression_level the used compression level. Should be between 1 and 22.
19 * 19 *
20 * @return the compressed data. 20 * @return the compressed data.
21 */ 21 */
22std::vector<u8> CompressDataZSTD(const u8* source, std::size_t source_size, s32 compression_level); 22std::vector<u8> CompressDataZSTD(std::span<const u8> source, s32 compression_level);
23 23
24/** 24/**
25 * Compresses a source memory region with Zstandard with the default compression level and returns 25 * Compresses a source memory region with Zstandard with the default compression level and returns
26 * the compressed data in a vector. 26 * the compressed data in a vector.
27 * 27 *
28 * @param source the uncompressed source memory region. 28 * @param source the uncompressed source memory region.
29 * @param source_size the size in bytes of the uncompressed source memory region.
30 * 29 *
31 * @return the compressed data. 30 * @return the compressed data.
32 */ 31 */
33std::vector<u8> CompressDataZSTDDefault(const u8* source, std::size_t source_size); 32std::vector<u8> CompressDataZSTDDefault(std::span<const u8> source);
34 33
35/** 34/**
36 * Decompresses a source memory region with Zstandard and returns the uncompressed data in a vector. 35 * Decompresses a source memory region with Zstandard and returns the uncompressed data in a vector.