forked from radekstepan/LZW
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patharray.c
More file actions
24 lines (19 loc) · 680 Bytes
/
Copy patharray.c
File metadata and controls
24 lines (19 loc) · 680 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
typedef struct{
int prefix; // prefix for byte > 255
int character; // the last byte of the string
} DictElement;
void dictionaryArrayAdd(int prefix, int character, int value);
int dictionaryArrayPrefix(int value);
int dictionaryArrayCharacter(int value);
DictElement dictionaryArray[4095];
// add prefix + character to the dictionary
void dictionaryArrayAdd(int prefix, int character, int value) {
dictionaryArray[value].prefix = prefix;
dictionaryArray[value].character = character;
}
int dictionaryArrayPrefix(int value) {
return dictionaryArray[value].prefix;
}
int dictionaryArrayCharacter(int value) {
return dictionaryArray[value].character;
}