Sigrid Solveig Haflínudóttirrename .inc → .h48299e11 year agoHistory
39 lines · 825 B · C
RawDownload
/*  pointer hash table  optimized for storing info about particular values*/ #include "sl.h" #if defined(BITS64)static u64int_pinthash(u64int key){	key = (~key) + (key << 21); // key = (key << 21) - key - 1;	key =  key ^ (key >> 24);	key = (key + (key << 3)) + (key << 8); // key * 265	key =  key ^ (key >> 14);	key = (key + (key << 2)) + (key << 4); // key * 21	key =  key ^ (key >> 28);	key =  key + (key << 31);	return key;}#elsestatic u32int_pinthash(u32int a){	a = (a+0x7ed55d16) + (a<<12);	a = (a^0xc761c23c) ^ (a>>19);	a = (a+0x165667b1) + (a<<5);	a = (a+0xd3a2646c) ^ (a<<9);	a = (a+0xfd7046c5) + (a<<3);	a = (a^0xb55a4f09) ^ (a>>16);	return a;}#endif #define HTNAME(suffix) ptrhash##suffix#define HFUNC(v) _pinthash((sl_v)(v))#define EQFUNC(x, y) ((x) == (y)) #include "htable_c.h"

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t