Renaming
[satune.git] / src / Collections / structs.c
1 #include "structs.h"
2 #include "mymemory.h"
3 #include "orderpair.h"
4
5 VectorImpl(Table, Table *, 4);
6 VectorImpl(Set, Set *, 4);
7 VectorImpl(Boolean, Boolean *, 4);
8 VectorImpl(Function, Function *, 4);
9 VectorImpl(Predicate, Predicate *, 4);
10 VectorImpl(Element, Element *, 4);
11 VectorImpl(Order, Order *, 4);
12 VectorImpl(TableEntry, TableEntry *, 4);
13 VectorImpl(ASTNode, ASTNode *, 4);
14 VectorImpl(Int, uint64_t, 4);
15
16 inline unsigned int Ptr_hash_function(void * hash) {
17         return (unsigned int)((uint64_t)hash >> 4);
18 }
19
20 inline bool Ptr_equals(void * key1, void * key2) {
21         return key1 == key2;
22 }
23
24 static inline unsigned int order_pair_hash_Function(OrderPair* This){
25         return (uint) (This->first << 2) ^ This->second;
26 }
27
28 static inline unsigned int order_pair_equals(OrderPair* key1, OrderPair* key2){
29         return key1->first== key2->first && key1->second == key2->second;
30 }
31
32 HashTableImpl(OrderPair, OrderPair *, OrderPair *, order_pair_hash_Function, order_pair_equals, ourfree);