1 // cln/symbol.hashcode().
4 #include "base/cl_sysdep.h"
7 #include "cln/symbol.h"
12 #include "base/cl_offsetof.h"
16 #define declare_alignof(where,type) \
17 struct CONCAT(aligndummy,__LINE__) { char slot1; type slot2; }; \
18 const uintptr_t where = offsetof(CONCAT(aligndummy,__LINE__), slot2);
20 uintptr_t 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 (uintptr_t)(s.pointer)
25 / (string_alignment & -string_alignment); // divide by power of 2