1 // cl_symbol hashcode().
12 #include "cl_offsetof.h"
14 #define declare_alignof(where,type) \
15 struct CONCAT(aligndummy,__LINE__) { char slot1; type slot2; }; \
16 const unsigned long where = offsetof(CONCAT(aligndummy,__LINE__), slot2);
18 unsigned long hashcode (const cl_symbol& s)
20 // Strings don't move in memory, so we can just take the address.
21 declare_alignof(string_alignment,cl_heap_string);
22 return (unsigned long)(s.pointer)
23 / (string_alignment & -string_alignment); // divide by power of 2