more edits
[satune.git] / src / Encoders / elementencoding.c
index f0510d6e50d39fc9eb0cddc297300003af6835f2..47c6ea0fef0f52f917ce7b69e4e09786b3d92e92 100644 (file)
@@ -29,33 +29,12 @@ void allocEncodingArrayElement(ElementEncoding *This, uint size) {
 }
 
 void allocInUseArrayElement(ElementEncoding *This, uint size) {
-       This->inUseArray=ourcalloc(1, size >> 6);
-}
-
-void allocElementConstraintVariables(ElementEncoding* This, uint numVars){
-       This->numVars = numVars;
-       This->variables = ourmalloc(sizeof(Constraint*) * numVars);
+       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;
 }
 
-void generateBinaryIndexEncodingVars(SATEncoder* encoder, ElementEncoding* This){
-       ASSERT(This->type==BINARYINDEX);
-       uint size = getElemEncodingInUseVarsSize(This);
-       allocElementConstraintVariables(This, NUMBITS(size-1));
-       getArrayNewVarsSATEncoder(encoder, This->numVars, This->variables);
-}
 
-void generateElementEncodingVariables(SATEncoder* encoder, ElementEncoding* This){
-       ASSERT(This->type!=ELEM_UNASSIGNED);
-       ASSERT(This->variables==NULL);
-       switch(This->type){
-               case BINARYINDEX:
-                       generateBinaryIndexEncodingVars(encoder, This);
-                       break;
-               default:
-                       ASSERT(0);
-       }
-}