25 lines
712 B
C++
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;
|
|
}
|
|
} |