-
Notifications
You must be signed in to change notification settings - Fork 2
/
encode.c
54 lines (45 loc) · 1.15 KB
/
encode.c
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
/**
Copyright (c) 2019 Vicente Romero Calero. All rights reserved.
Licensed under the MIT License.
See LICENSE file in the project root for full license information.
*/
#include "encodebits.h"
#include "internals.h"
#include "stack.h"
#define ENC_STACK_MAX_SIZE 64
struct enc_bit_cluster {
size_t from;
size_t length;
unsigned int bit_pos;
};
CREATE_STACK(enc_stack, struct enc_bit_cluster, ENC_STACK_MAX_SIZE)
#define LIST_MAX_VALUES VTENC_LIST_MAX_VALUES
#define TYPE uint8_t
#define BITWIDTH 8
#define SET_MAX_VALUES VTENC_SET_MAX_VALUES8
#include "encode_generic.h"
#undef TYPE
#undef BITWIDTH
#undef SET_MAX_VALUES
#define TYPE uint16_t
#define BITWIDTH 16
#define SET_MAX_VALUES VTENC_SET_MAX_VALUES16
#include "encode_generic.h"
#undef TYPE
#undef BITWIDTH
#undef SET_MAX_VALUES
#define TYPE uint32_t
#define BITWIDTH 32
#define SET_MAX_VALUES VTENC_SET_MAX_VALUES32
#include "encode_generic.h"
#undef TYPE
#undef BITWIDTH
#undef SET_MAX_VALUES
#define TYPE uint64_t
#define BITWIDTH 64
#define SET_MAX_VALUES VTENC_SET_MAX_VALUES64
#include "encode_generic.h"
#undef TYPE
#undef BITWIDTH
#undef SET_MAX_VALUES
#undef LIST_MAX_VALUES