-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRleData.h
More file actions
37 lines (29 loc) · 697 Bytes
/
RleData.h
File metadata and controls
37 lines (29 loc) · 697 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once
#include <ostream>
// RLE Compression/Decompression
struct RleData
{
// Memory which stores either compressed or decompressed data
char* mData;
// Number of elements of type T that data is pointing to
int mSize;
RleData()
: mData(nullptr)
, mSize(0)
{ }
~RleData()
{
delete[] mData;
}
// Compresses input data and stores it in mData
void Compress(const char* input, size_t inSize);
// Decompresses input data and stores it in mData
void Decompress(const char* input, size_t inSize, size_t outSize);
// Outputs mData
friend std::ostream& operator<< (std::ostream& stream, const RleData& rhs);
size_t MaxRunSize()
{
// Bitwise magic
return 127;
}
};