]> git.sesse.net Git - remoteglot-book/blob - hash.cpp
Change to even shorter prefix length; down from 3.8 to 3.1 GB (single partition is...
[remoteglot-book] / hash.cpp
1 #include <farmhash.h>
2 #include <algorithm>
3 #include "hash.h"
4
5 using namespace std;
6
7 int hash_key_to_bucket(const char* s, size_t len, int num_buckets)
8 {
9         len = min<size_t>(len, HASH_PREFIX_BYTES);
10         return util::Fingerprint32(s, len) % num_buckets;
11 }