-
Notifications
You must be signed in to change notification settings - Fork 102
Open
Labels
Description
There are two constants named using this term, but I can't find any other use of it in Bagwell's paper or the context of HAMTs.
unordered-containers/Data/HashMap/Internal.hs
Lines 2361 to 2362 in 4da2c20
bitsPerSubkey :: Int | |
bitsPerSubkey = 5 |
unordered-containers/Data/HashMap/Internal.hs
Lines 2367 to 2368 in 4da2c20
subkeyMask :: Bitmap | |
subkeyMask = 1 `unsafeShiftL` bitsPerSubkey - 1 |
From this context I suspect that a subkey is a 5-bit part of a hash. I.e. a 64-bit or 32-bit hash can be understood as a sequence of subkeys. For example:
hash32 = 0b10_00101_00100_00011_00010_00001_00000
subkeys(hash32) = [0b00000, 0b00001, 0b00010, 0b00011, 0b00100, 0b00101, 0b10]
Subsequent subkeys of a given hash are used to navigate the tree at subsequent levels:
index(hash, shift) = subkeys(hash) !! (shift / bitsPerSubkey)