Skip to content

Commit

Permalink
Remove some dead code from insertKeyExists (#456)
Browse files Browse the repository at this point in the history
The code was handling the case where a BitmapIndexed node does not
have a sub-node that could contain the known-to-exist key.
  • Loading branch information
sjakobi authored May 8, 2022
1 parent 008c345 commit 813d57c
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions Data/HashMap/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -881,14 +881,10 @@ insertKeyExists !collPos0 !h0 !k0 x0 !m0 = go collPos0 h0 k0 x0 0 m0
where
go !_collPos !h !k x !_s (Leaf _hy _kx)
= Leaf h (L k x)
go collPos h k x s (BitmapIndexed b ary)
| b .&. m == 0 =
let !ary' = A.insert ary i $ Leaf h (L k x)
in bitmapIndexedOrFull (b .|. m) ary'
| otherwise =
let !st = A.index ary i
!st' = go collPos h k x (nextShift s) st
in BitmapIndexed b (A.update ary i st')
go collPos h k x s (BitmapIndexed b ary) =
let !st = A.index ary i
!st' = go collPos h k x (nextShift s) st
in BitmapIndexed b (A.update ary i st')
where m = mask h s
i = sparseIndex b m
go collPos h k x s (Full ary) =
Expand Down

0 comments on commit 813d57c

Please sign in to comment.