Skip to content

Commit

Permalink
Fix bug in delete where the bitmap wasn't being computed correctly
Browse files Browse the repository at this point in the history
Closes #32
  • Loading branch information
tibbe committed Mar 14, 2012
1 parent d93707c commit a2428f4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Data/HashMap/Base.hs
Expand Up @@ -466,7 +466,8 @@ delete k0 m0 = runST (go h0 k0 0 m0)
else case st' of
Empty -> do
ary' <- A.delete' ary i
return $! BitmapIndexed (mask h s) ary'
let bm = fullNodeMask .&. complement (1 `unsafeShiftL` i)
return $! BitmapIndexed bm ary'
_ -> do
ary' <- A.update' ary i st'
return $! Full ary'
Expand Down Expand Up @@ -1038,8 +1039,7 @@ index w s = fromIntegral $ (unsafeShiftR w s) .&. subkeyMask

-- | A bitmask with the 'bitsPerSubkey' least significant bits set.
fullNodeMask :: Bitmap
fullNodeMask = complement (complement 0 `unsafeShiftL`
fromIntegral (1 `unsafeShiftL` bitsPerSubkey))
fullNodeMask = complement (complement 0 `unsafeShiftL` maxChildren)
{-# INLINE fullNodeMask #-}

-- | Check if two the two arguments are the same value. N.B. This
Expand Down

0 comments on commit a2428f4

Please sign in to comment.