This repository has been archived by the owner on Jun 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
utilities.h
61 lines (48 loc) · 2.21 KB
/
utilities.h
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
------------------------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
------------------------------------------------------------------------------
*/
#include "stdafx.h"
// The decompressor will write outside of the target buffer.
#define SAFE_SPACE 64
// Global Vars
enum {
kCompressor_Kraken = 8,
kCompressor_Mermaid = 9,
kCompressor_Selkie = 11,
kCompressor_Hydra = 12,
kCompressor_Leviathan = 13,
};
// typedef's
// XXX Need to remove this!!
//typedef int OodLZ_CompressFunc(int codec, uint8_t *src_buf, size_t src_len,
// uint8_t *dst_buf, int level, void *opts,
// size_t offs, size_t unused, void *scratch,
// size_t scratch_size);
//typedef int OodLZ_DecompressFunc(uint8_t *src_buf, int src_len, uint8_t *dst,
// size_t dst_size, int fuzz, int crc, int verbose,
// uint8_t *dst_base, size_t e, void *cb, void *cb_ctx,
// void *scratch, size_t scratch_size, int threadPhase);
// Prototypes
int CountLeadingZeros(uint32_t bits);
uint32_t _rotl(uint32_t x, uint32_t n);
void *MallocAligned(size_t size, size_t alignment);
void FreeAligned(void *p);
uint32_t BSR(uint32_t x);
uint32_t BSF(uint32_t x);
void error(const char *s, const char *curfile = NULL);
byte *load_file(const char *filename, int *size);
int ParseCmdLine(int argc, char *argv[]);
bool Verify(const char *filename, uint8_t *output, int outbytes, const char *curfile);
void FillByteOverflow16(uint8_t *dst, uint8_t v, size_t n);
void LoadLib();