AuroraRuntime/Source/Compression/Compression.hpp
Reece 3be51018c9 [-] Remove Flush from public compression interface
[+] Improved base block [de]compression objects
2021-07-11 12:36:15 +01:00

25 lines
712 B
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: Compression.hpp
Date: 2021-6-17
Author: Reece
***/
#pragma once
namespace Aurora::Compression
{
static const AuUInt64 kChunkSize = 4096;
// This is acommon prolog required by BlockCompressors and BlockDecompressors. dw about it.
static inline bool StreamRead(void * buffer, AuUInt32 &len, AuList<AuUInt8> &vec)
{
len = std::min(AuUInt32(vec.size()), len);
if (len == 0) return false;
std::memcpy(buffer, vec.data(), len);
auto rem = vec.size() - len;
std::memmove(vec.data(), vec.data() + len, rem);
vec.resize(rem);
return true;
}
}