1 // cl_rcpointer hash tables
3 #ifndef _CL_RCPOINTER2_HASHWEAK_RCPOINTER_H
4 #define _CL_RCPOINTER2_HASHWEAK_RCPOINTER_H
8 #include "cl_hash2weak.h"
11 static inline bool equal (const cl_rcpointer& x, const cl_rcpointer& y)
12 { return (x.pointer == y.pointer); }
14 // Hash code. Luckily objects don't move around in memory.
15 inline unsigned long hashcode (const cl_rcpointer& x1, const cl_rcpointer& x2)
17 var unsigned long hashcode1 = (unsigned long)x1.pointer;
18 var unsigned long hashcode2 = (unsigned long)x2.pointer;
19 hashcode2 = (hashcode2 << 5) | (hashcode2 >> (long_bitsize-5)); // rotate
20 return hashcode1 ^ hashcode2;
23 typedef cl_htentry2<cl_rcpointer,cl_rcpointer,cl_rcpointer> cl_htentry_from_rcpointer2_to_rcpointer;
25 typedef cl_heap_weak_hashtable_2<cl_rcpointer,cl_rcpointer,cl_rcpointer> cl_heap_weak_hashtable_from_rcpointer2_to_rcpointer;
27 typedef _cl_hashtable_iterator<cl_htentry_from_rcpointer2_to_rcpointer> cl_hashtable_from_rcpointer2_to_rcpointer_iterator;
29 struct cl_wht_from_rcpointer2_to_rcpointer : public cl_rcpointer {
31 cl_wht_from_rcpointer2_to_rcpointer (cl_boolean (*maygc_htentry) (const cl_htentry_from_rcpointer2_to_rcpointer&));
32 cl_wht_from_rcpointer2_to_rcpointer (const cl_wht_from_rcpointer2_to_rcpointer&);
33 // Assignment operators.
34 cl_wht_from_rcpointer2_to_rcpointer& operator= (const cl_wht_from_rcpointer2_to_rcpointer&);
36 cl_hashtable_from_rcpointer2_to_rcpointer_iterator iterator () const
37 { return ((cl_heap_weak_hashtable_from_rcpointer2_to_rcpointer*)pointer)->iterator(); }
39 cl_rcpointer * get (const cl_rcpointer& x, const cl_rcpointer& y) const;
41 void put (const cl_rcpointer& x, const cl_rcpointer& y, const cl_rcpointer& z) const;
44 #endif /* _CL_RCPOINTER2_HASHWEAK_RCPOINTER_H */