aboutsummaryrefslogtreecommitdiff
path: root/src/common/container.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-09-28 19:23:54 +0000
committerNick Mathewson <nickm@torproject.org>2007-09-28 19:23:54 +0000
commit38ac9f6005ce1d95394e9757d36276e48bc5d357 (patch)
treedf96f7d04e3968ed9e0a8b192f895aa1447730b6 /src/common/container.c
parentb5c8a8ae53c141c14651485794999910d0168be8 (diff)
downloadtor-38ac9f6005ce1d95394e9757d36276e48bc5d357.tar.gz
tor-38ac9f6005ce1d95394e9757d36276e48bc5d357.zip
r14682@Kushana: nickm | 2007-09-28 15:23:38 -0400
From little acorns: redo our string and digest hashing code to be faster, since this stuff may be critical-path. svn:r11700
Diffstat (limited to 'src/common/container.c')
-rw-r--r--src/common/container.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/common/container.c b/src/common/container.c
index d8b910738c..b0c201ccf9 100644
--- a/src/common/container.c
+++ b/src/common/container.c
@@ -694,8 +694,13 @@ digestmap_entries_eq(const digestmap_entry_t *a, const digestmap_entry_t *b)
static INLINE unsigned int
digestmap_entry_hash(const digestmap_entry_t *a)
{
- uint32_t *p = (uint32_t*)a->key;
- return ht_improve_hash(p[0] ^ p[1] ^ p[2] ^ p[3] ^ p[4]);
+#if SIZEOF_INT != 8
+ const uint32_t *p = (const uint32_t*)a->key;
+ return p[0] ^ p[1] ^ p[2] ^ p[3] ^ p[4];
+#else
+ const uint64_t *p = (const uint64_t*)a->key;
+ return p[0] ^ p[1];
+#endif
}
HT_PROTOTYPE(strmap_impl, strmap_entry_t, node, strmap_entry_hash,