removing true nodes from the OrderGraph
[satune.git] / src / Encoders / elementencoding.c
1 #include "elementencoding.h"
2 #include "common.h"
3 #include "naiveencoder.h"
4 #include "element.h"
5 #include "satencoder.h"
6
7 void initElementEncoding(ElementEncoding *This, Element *element) {
8         This->element = element;
9         This->type = ELEM_UNASSIGNED;
10         This->variables = NULL;
11         This->encodingArray = NULL;
12         This->inUseArray = NULL;
13         This->numVars = 0;
14         This->encArraySize = 0;
15 }
16
17 void deleteElementEncoding(ElementEncoding *This) {
18         if (This->variables != NULL)
19                 ourfree(This->variables);
20         if (This->encodingArray != NULL)
21                 ourfree(This->encodingArray);
22         if (This->inUseArray != NULL)
23                 ourfree(This->inUseArray);
24 }
25
26 void allocEncodingArrayElement(ElementEncoding *This, uint size) {
27         This->encodingArray = ourcalloc(1, sizeof(uint64_t) * size);
28         This->encArraySize = size;
29 }
30
31 void allocInUseArrayElement(ElementEncoding *This, uint size) {
32         uint bytes = ((size + ((1 << 9) - 1)) >> 6) & ~7;//Depends on size of inUseArray
33         This->inUseArray = ourcalloc(1, bytes);
34 }
35
36 void setElementEncodingType(ElementEncoding *This, ElementEncodingType type) {
37         This->type = type;
38 }
39
40