diff --git a/lib/nghttp2_map.c b/lib/nghttp2_map.c index ac23c1aa..4d50413b 100644 --- a/lib/nghttp2_map.c +++ b/lib/nghttp2_map.c @@ -86,12 +86,13 @@ void nghttp2_map_entry_init(nghttp2_map_entry *entry, key_type key) entry->next = NULL; } -/* Same hash function in openjdk HashMap source code. */ +/* Same hash function in android HashMap source code. */ /* The |mod| must be power of 2 */ static int32_t hash(int32_t h, int32_t mod) { h ^= (h >> 20) ^ (h >> 12); - return (h ^ (h >> 7) ^ (h >> 4)) & (mod - 1); + h ^= (h >> 7) ^ (h >> 4); + return h & (mod - 1); } static int insert(nghttp2_map_entry **table, size_t tablelen,