X-Git-Url: http://plrg.eecs.uci.edu/git/?p=satune.git;a=blobdiff_plain;f=src%2FEncoders%2Felementencoding.c;h=08385db6921096a5bb6b3fcd3c010ae4f3360c7b;hp=095f99ded848dc8dc3d4316b951a0eef971de42e;hb=c5aa88ae6e416bd79459c619b2a30bf565c50ac0;hpb=66ab53e7949882740909d130a3f6e5c44bbe7653;ds=sidebyside diff --git a/src/Encoders/elementencoding.c b/src/Encoders/elementencoding.c index 095f99d..08385db 100644 --- a/src/Encoders/elementencoding.c +++ b/src/Encoders/elementencoding.c @@ -1,19 +1,29 @@ #include "elementencoding.h" ElementEncoding * allocElementEncoding(ElementEncodingType type, Element *element) { - ElementEncoding * this=(ElementEncoding *)ourmalloc(sizeof(ElementEncoding)); - this->element=element; - this->type=type; - this->variables=NULL; - this->encodingArray=NULL; - this->numVars=0; - return this; + ElementEncoding * This=ourmalloc(sizeof(ElementEncoding)); + This->element=element; + This->type=type; + This->variables=NULL; + This->encodingArray=NULL; + This->numVars=0; + return This; } -void deleteElementEncoding(ElementEncoding *this) { - if (this->variables!=NULL) - ourfree(this->variables); - if (this->encodingArray!=NULL) - ourfree(this->encodingArray); - ourfree(this); +void deleteElementEncoding(ElementEncoding *This) { + if (This->variables!=NULL) + ourfree(This->variables); + if (This->encodingArray!=NULL) + 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); +} + +void allocInUseArrayElement(ElementEncoding *This, uint size) { + This->inUseArray=ourcalloc(1, size >> 6); }