Bug Fixes + add more tracing prints + turning off some optimizations
[satune.git] / src / Collections / corestructs.h
index e30a5309b57b0330c37fe9ff307ddc5f02fc1163..5e8a7de935b8f1e3818ed156efc9d03c7cb150f0 100644 (file)
@@ -4,6 +4,11 @@
 #include "cppvector.h"
 #include "hashset.h"
 
+//How much should we shift pointers when computing hash functions
+//5 appears to be the minimum value for Ubuntu 64-bit
+
+#define PTRSHIFT 5
+
 class BooleanEdge {
  public:
  BooleanEdge() : b(NULL) {}
@@ -25,12 +30,12 @@ inline bool boolEdgeEquals(BooleanEdge b1, BooleanEdge b2) {
 }
 
 inline unsigned int boolEdgeHash(BooleanEdge b) {
-       return (unsigned int) (((uintptr_t)b.getRaw())>>4);
+       return (unsigned int) (((uintptr_t)b.getRaw())>>PTRSHIFT);
 }
                                                                        
-typedef Hashset<BooleanEdge, uintptr_t, 4, & boolEdgeHash, & boolEdgeEquals> HashsetBooleanEdge;
-typedef Hashset<Order *, uintptr_t, 4> HashsetOrder;
-typedef SetIterator<BooleanEdge, uintptr_t, 4, & boolEdgeHash, & boolEdgeEquals> SetIteratorBooleanEdge;
-typedef SetIterator<Order *, uintptr_t, 4> SetIteratorOrder;
+typedef Hashset<BooleanEdge, uintptr_t, PTRSHIFT, & boolEdgeHash, & boolEdgeEquals> HashsetBooleanEdge;
+typedef Hashset<Order *, uintptr_t, PTRSHIFT> HashsetOrder;
+typedef SetIterator<BooleanEdge, uintptr_t, PTRSHIFT, & boolEdgeHash, & boolEdgeEquals> SetIteratorBooleanEdge;
+typedef SetIterator<Order *, uintptr_t, PTRSHIFT> SetIteratorOrder;
 
 #endif