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