GETPREDICATETYPE(predicate) = TABLEPRED;
predicate->table=table;
predicate->undefinedbehavior=undefBehavior;
- return predicate;
+ return &predicate->base;
}
void deletePredicate(Predicate* predicate){
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);
#define HASH_SET_H
#include "hashtable.h"
-#define HashSetDef(Name, _Key, hash_function, equals) \
+#define HashSetDef(Name, _Key) \
struct LinkNode ## Name { \
_Key key; \
struct LinkNode ## Name *prev; \
HashSet ## Name * set; \
}; \
typedef struct HSIterator ## Name HSIterator ## Name; \
- HashTableDef(Name ## Set, _Key, LinkNode ## Name *, hash_function, equals); \
+ HashTableDef(Name ## Set, _Key, LinkNode ## Name *); \
HSIterator ## Name * allocHSIterator ## Name(LinkNode ## Name *_curr, HashSet ## Name * _set); \
void deleteIter ## Name(HSIterator ## Name *hsit); \
bool hasNext ## Name(HSIterator ## Name *hsit); \
* @tparam _Key Type name for the key
* @tparam _Val Type name for the values to be stored
*/
-#define HashTableDef(Name, _Key, _Val, hash_function, equals)\
+#define HashTableDef(Name, _Key, _Val)\
struct hashlistnode ## Name { \
_Key key; \
_Val val; \
#include "structs.h"
#include "mymemory.h"
+#include "order.h"
VectorImpl(Table, Table *, 4);
VectorImpl(Set, Set *, 4);
VectorImpl(ASTNode, ASTNode *, 4);
VectorImpl(Int, uint64_t, 4);
+inline unsigned int Ptr_hash_function(void * hash) {
+ return (unsigned int)((uint64_t)hash >> 4);
+}
+
+inline bool Ptr_equals(void * key1, void * key2) {
+ return key1 == key2;
+}
+
+inline unsigned int BooleanOrder_hash_Function(BooleanOrder* This){
+ return This->first ^ This->second;
+}
+
+inline 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);
VectorDef(Int, uint64_t, 4);
-inline unsigned int Ptr_hash_function(void * hash) {
- return (unsigned int)((uint64_t)hash >> 4);
-}
-inline bool Ptr_equals(void * key1, void * key2) {
- return key1 == key2;
-}
+HashTableDef(Void, void *, void *);
+HashTableDef(BoolConst, BooleanOrder *, Constraint *);
-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;
-}
-
-HashTableDef(Void, void *, void *, Ptr_hash_function, Ptr_equals);
-HashTableDef(BoolConst, BooleanOrder *, Constraint *, BooleanOrder_hash_Function, BooleanOrder_equals);
-
-HashSetDef(Void, void *, Ptr_hash_function, Ptr_equals);
+HashSetDef(Void, void *);
#endif