X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FHash.hh;h=f0fab50705aca13e9c554d5eb14c0c161a36699e;hp=c0695447ab303f6438b264fc4b2e9141fb0ad661;hb=5fa5f117f28922a7e539a432367960c1a61f837d;hpb=a5f0d391406a68275b41448fc3f49e8d8396c497 diff --git a/src/Moof/Hash.hh b/src/Moof/Hash.hh index c069544..f0fab50 100644 --- a/src/Moof/Hash.hh +++ b/src/Moof/Hash.hh @@ -37,13 +37,19 @@ namespace Mf { -unsigned MurmurHash2_(const void* key, int len, unsigned seed); - -struct hash_string +struct getHash { + // generic hash function + unsigned operator()(const void* key, int len, unsigned seed = -1) const; + inline unsigned operator()(const std::string& val) const { - return MurmurHash2_(val.data(), val.length(), -1); + return (*this)(val.data(), val.length()); + } + + inline unsigned operator()(int val) const + { + return val; } };