fixing some bugs ...
authorHamed <hamed.gorjiara@gmail.com>
Fri, 30 Jun 2017 17:18:10 +0000 (10:18 -0700)
committerHamed <hamed.gorjiara@gmail.com>
Fri, 30 Jun 2017 17:18:10 +0000 (10:18 -0700)
src/AST/predicate.c
src/Backend/satencoder.c
src/Collections/structs.c
src/Collections/structs.h

index 97bbd1818b5f57027ed7eab07c61f0fb46d19c9d..ebb3c14f1c8650f411c259e2699ad11ce1f2fc09 100644 (file)
@@ -13,7 +13,7 @@ Predicate* allocPredicateTable(Table* table, UndefinedBehavior undefBehavior){
        GETPREDICATETYPE(predicate) = TABLEPRED;
        predicate->table=table;
        predicate->undefinedbehavior=undefBehavior;
-       return predicate;
+       return &predicate->base;
 }
 
 void deletePredicate(Predicate* predicate){
index 9fd551985ebbaf39848d73218e3160425a2396e8..2b631ff26be1bce0228da5c7a9f77ba77526c669 100644 (file)
@@ -187,9 +187,9 @@ Constraint * encodeTotalOrderSATEncoder(SATEncoder *This, BooleanOrder * boolOrd
                uint size= getSizeVectorBoolean(orderConstrs);
                for(uint i=0; i<size; i++){
                        ASSERT(GETBOOLEANTYPE( getVectorBoolean(orderConstrs, i)) == ORDERCONST );
-                       BooleanOrder* tmp = (BooleanPredicate*)getVectorBoolean(orderConstrs, i);
+                       BooleanOrder* tmp = (BooleanOrder*)getVectorBoolean(orderConstrs, i);
                        BooleanOrder* newBool;
-                       Constraint* first, second;
+                       Constraint *first, *second;
                        if(tmp->second==boolOrder->first){
                                newBool = (BooleanOrder*)allocBooleanOrder(tmp->order,tmp->first,boolOrder->second);
                                first = encodeTotalOrderSATEncoder(This, tmp);
index 48886ac0fabe2ee1c451abdc5262b9fd32066f3b..961147221f2cf2eb7bdf545f0fd37f045ee9178e 100644 (file)
@@ -1,5 +1,6 @@
 #include "structs.h"
 #include "mymemory.h"
+#include "boolean.h"
 
 VectorImpl(Table, Table *, 4);
 VectorImpl(Set, Set *, 4);
@@ -13,4 +14,12 @@ VectorImpl(TableEntry, TableEntry *, 4);
 VectorImpl(ASTNode, ASTNode *, 4);
 VectorImpl(Int, uint64_t, 4);
 
+unsigned int BooleanOrder_hash_Function(BooleanOrder* This){
+       return ((This->first+This->second)*(This->first+This->second+1))/2 + This->second;
+}
+
+unsigned int BooleanOrder_equals(BooleanOrder* key1, BooleanOrder* key2){
+       return key1->first== key2->first && key1->second == key2->second;
+}
+
 HashTableImpl(BoolConst, BooleanOrder *, Constraint *, BooleanOrder_hash_Function, BooleanOrder_equals);
index 1ae5f8ca9eabdfe0f56f7b844bc5bb4208bdd841..55376b724fe1a662028f8867e0857feb36e2674c 100644 (file)
@@ -32,13 +32,8 @@ inline bool Ptr_equals(void * key1, void * key2) {
        return key1 == key2;
 }
 
-inline unsigned int BooleanOrder_hash_Function(BooleanOrder* This){
-       return ((This->first+This->second)(This->first+This->second+1))/2 + This->second;
-}
-
-inline unsigned int BooleanOrder_equals(BooleanOrder* key1, BooleanOrder* key2){
-       return key1->first== key2->first && key1->second == key2->second;
-}
+unsigned int BooleanOrder_hash_Function(BooleanOrder* This);
+unsigned int BooleanOrder_equals(BooleanOrder* key1, BooleanOrder* key2);
 
 HashTableDef(Void, void *, void *, Ptr_hash_function, Ptr_equals);
 HashTableDef(BoolConst, BooleanOrder *, Constraint *, BooleanOrder_hash_Function, BooleanOrder_equals);