File tree Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -1300,17 +1300,20 @@ alter' f !h0 !k0 = go_alter' h0 k0 0
13001300 Just v' -> bitmapIndexedOrFull (b .|. m) $! A. insert ary i $! Leaf h $! L k v'
13011301 | otherwise =
13021302 case A. index# ary i of
1303- (# ! st # ) -> case go_alter' h k (nextShift s) st of
1304- Empty
1305- | A. length ary == 2
1306- , (# l # ) <- A. index# ary (otherOfOneOrZero i)
1307- , isLeafOrCollision l
1308- -> l
1309- | otherwise -> BitmapIndexed (b .&. complement m) (A. delete ary i)
1310- st'
1311- | isLeafOrCollision st' && A. length ary == 1 -> st'
1312- | st' `ptrEq` st -> t
1313- | otherwise -> BitmapIndexed b (A. update ary i st')
1303+ (# ! st # ) -> do
1304+ let ! st' = go_alter' h k (nextShift s) st
1305+ if st' `ptrEq` st
1306+ then t
1307+ else case st' of
1308+ Empty
1309+ | A. length ary == 2
1310+ , (# l # ) <- A. index# ary (otherOfOneOrZero i)
1311+ , isLeafOrCollision l
1312+ -> l
1313+ | otherwise
1314+ -> BitmapIndexed (b .&. complement m) (A. delete ary i)
1315+ l | isLeafOrCollision l && A. length ary == 1 -> l
1316+ _ -> BitmapIndexed b (A. update ary i st')
13141317 where
13151318 m = mask h s
13161319 i = sparseIndex b m
You can’t perform that action at this time.
0 commit comments