From d566b8ca31643386ed8315cd93e5b9bbb906ca01 Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Wed, 5 Aug 2020 16:03:40 -0700 Subject: [PATCH] Add explanation for a Dict TODO item --- src/Dict.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Dict.cc b/src/Dict.cc index 038224b869..4f29c16b68 100644 --- a/src/Dict.cc +++ b/src/Dict.cc @@ -194,9 +194,13 @@ TEST_CASE("dict iteration") { if ( count == 0 ) { - // The DictEntry constructor typecasts this down to a uint32_t, so we can't just check the - // value directly. - // TODO: why? + // The DictEntry constructor typecasts this down to a uint32_t, so + // we can't just check the value directly. + // Explanation: hash_t is 64bit, open-dict only uses 32bit hash to + // save space for each item (24 bytes aligned). OpenDict has table + // size of 2^N and only take the lower bits of the hash. (The + // original hash takes transformation in FibHash() to map into a + // smaller 2^N range). CHECK(it_key->Hash() == (uint32_t)key2->Hash()); CHECK(*entry == 10); }