Code cleanup

This commit is contained in:
Tatsuhiro Tsujikawa 2014-05-10 18:27:53 +09:00
parent 74ad10c355
commit 0707720b11
1 changed files with 3 additions and 2 deletions

View File

@ -86,12 +86,13 @@ void nghttp2_map_entry_init(nghttp2_map_entry *entry, key_type key)
entry->next = NULL; 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 */ /* The |mod| must be power of 2 */
static int32_t hash(int32_t h, int32_t mod) static int32_t hash(int32_t h, int32_t mod)
{ {
h ^= (h >> 20) ^ (h >> 12); 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, static int insert(nghttp2_map_entry **table, size_t tablelen,