summaryrefslogtreecommitdiff
path: root/lib/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/hash.c')
-rw-r--r--lib/hash.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/hash.c b/lib/hash.c
index 95643bbae0..57a07b5f8e 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -87,13 +87,8 @@ hash_alloc_intern (void *arg)
}
#define hash_update_ssq(hz, old, new) \
- do { \
- long double res; \
- res = powl(old, 2.0); \
- hz->stats.ssq -= (uint64_t) res;\
- res = powl(new, 2.0); \
- hz->stats.ssq += (uint64_t) res; \
- } while (0); \
+ atomic_fetch_add_explicit(&hz->stats.ssq, (new + old)*(new - old),\
+ memory_order_relaxed);
/* Expand hash if the chain length exceeds the threshold. */
static void hash_expand (struct hash *hash)