Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
String hash
template<unsigned int N, unsigned int I>
struct FnvHash
{
__forceinline static uint32 Hash(const char (&text)[N])
{
return (FnvHash<N, I - 1>::Hash(text) ^ text[I - 1]) * 16777619u;
}
};
template<unsigned int N>
struct FnvHash<N, 1>
{
__forceinline static uint32 Hash(const char (&text)[N])
{
return (2166136261u ^ text[0]) * 16777619u;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.