aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/hashtables.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-10-08 22:54:32 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-10-09 01:57:47 +0200
commitf985de2c5acc9a9086829d52237fce0d2a663277 (patch)
tree28ce187bcd7aad1e03ab92f7ec9695d343f44973 /src/hashtables.c
parentmain: change module description (diff)
downloadwireguard-monolithic-historical-f985de2c5acc9a9086829d52237fce0d2a663277.tar.xz
wireguard-monolithic-historical-f985de2c5acc9a9086829d52237fce0d2a663277.zip
global: give if statements brackets and other cleanups
Diffstat (limited to 'src/hashtables.c')
-rw-r--r--src/hashtables.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/hashtables.c b/src/hashtables.c
index ee55b8e..14baf5b 100644
--- a/src/hashtables.c
+++ b/src/hashtables.c
@@ -14,9 +14,9 @@ static struct hlist_head *pubkey_bucket(struct pubkey_hashtable *table,
* the bits are uniformly distributed, we can then mask off to get the
* bits we need.
*/
- return &table->hashtable[
- siphash(pubkey, NOISE_PUBLIC_KEY_LEN, &table->key) &
- (HASH_SIZE(table->hashtable) - 1)];
+ const u64 hash = siphash(pubkey, NOISE_PUBLIC_KEY_LEN, &table->key);
+
+ return &table->hashtable[hash & (HASH_SIZE(table->hashtable) - 1)];
}
void wg_pubkey_hashtable_init(struct pubkey_hashtable *table)