]> git.sesse.net Git - remoteglot-book/commitdiff
Fix inverted logic in the hash. Gets me every time.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 11 Dec 2014 19:21:21 +0000 (20:21 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 11 Dec 2014 19:21:21 +0000 (20:21 +0100)
hash.cpp

index 72ed743533520212e27bc4396292240f8bc343a8..af56263ec5f71c71c161fd956572201eab6791e6 100644 (file)
--- a/hash.cpp
+++ b/hash.cpp
@@ -9,6 +9,6 @@ int hash_key_to_bucket(const char* s, size_t len, int num_buckets)
        // We hash only the first 10 bytes; it should be enough to get a
        // reasonable spread, but also mostly miss the move, so that
        // same position + different move usually land in the same bucket.
-       len = max<size_t>(len, 10);
+       len = min<size_t>(len, 10);
        return util::Fingerprint32(s, len) % num_buckets;
 }