This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// based on xxhash32 | |
unsigned int hash(char *data, size_t len) | |
{ | |
unsigned int hash; | |
if (len < 4) { | |
// load 3 bytes, overlapping if len < 3 | |
static unsigned char offset1[4] = { 0,0,1,1 }; | |
static unsigned char offset2[4] = { 0,0,0,2 }; | |
unsigned int h = data[0] + (data[offset1[len]]<<8) + (data[offset2[len]]<<16); | |
h = xxprime1 + h*xxprime2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if _WIN32 | |
struct Timer { | |
LARGE_INTEGER win32_freq; | |
LARGE_INTEGER win32_start; | |
Timer() { | |
QueryPerformanceFrequency(&win32_freq); | |
win32_start.QuadPart = 0; | |
} |