#include "elementencoding.h"
+#include "common.h"
+#include "naiveencoder.h"
+#include "element.h"
+#include "satencoder.h"
-ElementEncoding * allocElementEncoding(ElementEncodingType type, Element *element) {
- ElementEncoding * This=ourmalloc(sizeof(ElementEncoding));
+void initElementEncoding(ElementEncoding * This, Element *element) {
This->element=element;
- This->type=type;
+ This->type=ELEM_UNASSIGNED;
This->variables=NULL;
This->encodingArray=NULL;
+ This->inUseArray=NULL;
This->numVars=0;
- return This;
+ This->encArraySize=0;
}
void deleteElementEncoding(ElementEncoding *This) {
ourfree(This->encodingArray);
if (This->inUseArray!=NULL)
ourfree(This->inUseArray);
- ourfree(This);
}
void allocEncodingArrayElement(ElementEncoding *This, uint size) {
This->encodingArray=ourcalloc(1, sizeof(uint64_t)*size);
+ This->encArraySize=size;
}
void allocInUseArrayElement(ElementEncoding *This, uint size) {
- This->inUseArray=ourcalloc(1, size >> 6);
+ uint bytes = ((size + ((1 << 9)-1)) >> 6)&~7;//Depends on size of inUseArray
+ This->inUseArray=ourcalloc(1, bytes);
}
+
+void setElementEncodingType(ElementEncoding* This, ElementEncodingType type){
+ This->type = type;
+}
+
+