Skip to content

Instantly share code, notes, and snippets.

@vaiorabbit
Created May 26, 2013 13:52
Show Gist options
  • Save vaiorabbit/5652864 to your computer and use it in GitHub Desktop.
Save vaiorabbit/5652864 to your computer and use it in GitHub Desktop.
typedef unsigned int uint32;
#define FNV1_32A_INIT 0x811c9dc5
#define FNV_32_PRIME 0x01000193
uint32 fnv32a( const char* str )
{
uint32 hval = FNV1_32A_INIT;
while ( *str )
{
hval ^= (uint32)*str++;
hval *= FNV_32_PRIME;
}
return hval;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment