@@ -117,7 +117,7 @@ module Data.HashMap.Internal
117
117
, mask
118
118
, index
119
119
, bitsPerSubkey
120
- , fullNodeMask
120
+ , fullBitmap
121
121
, sparseIndex
122
122
, two
123
123
, unionArrayBy
@@ -315,7 +315,7 @@ hashMapDataType = Data.mkDataType "Data.HashMap.Internal.HashMap" [fromListConst
315
315
-- | This type is used to store the hash of a key, as produced with 'hash'.
316
316
type Hash = Word
317
317
318
- -- | A bitmap as contained by a 'BitmapIndexed' node, or a 'fullNodeMask '
318
+ -- | A bitmap as contained by a 'BitmapIndexed' node, or a 'fullBitmap '
319
319
-- corresponding to a 'Full' node.
320
320
--
321
321
-- Only the lower 'maxChildren' bits are used. The remaining bits must be zeros.
@@ -758,7 +758,7 @@ bitmapIndexedOrFull :: Bitmap -> A.Array (HashMap k v) -> HashMap k v
758
758
-- @unionWith[Key]@ with GHC 9.2.2. See the Core diffs in
759
759
-- https://github.com/haskell-unordered-containers/unordered-containers/pull/376.
760
760
bitmapIndexedOrFull b ! ary
761
- | b == fullNodeMask = Full ary
761
+ | b == fullBitmap = Full ary
762
762
| otherwise = BitmapIndexed b ary
763
763
{-# INLINE bitmapIndexedOrFull #-}
764
764
@@ -1110,7 +1110,7 @@ delete' h0 k0 m0 = go h0 k0 0 m0
1110
1110
else case st' of
1111
1111
Empty ->
1112
1112
let ary' = A. delete ary i
1113
- bm = fullNodeMask .&. complement (1 `unsafeShiftL` i)
1113
+ bm = fullBitmap .&. complement (1 `unsafeShiftL` i)
1114
1114
in BitmapIndexed bm ary'
1115
1115
_ -> Full (A. update ary i st')
1116
1116
where i = index h s
@@ -1162,7 +1162,7 @@ deleteKeyExists !collPos0 !h0 !k0 !m0 = go collPos0 h0 k0 0 m0
1162
1162
in case st' of
1163
1163
Empty ->
1164
1164
let ary' = A. delete ary i
1165
- bm = fullNodeMask .&. complement (1 `unsafeShiftL` i)
1165
+ bm = fullBitmap .&. complement (1 `unsafeShiftL` i)
1166
1166
in BitmapIndexed bm ary'
1167
1167
_ -> Full (A. update ary i st')
1168
1168
where i = index h s
@@ -1471,9 +1471,9 @@ isSubmapOfBy comp !m1 !m2 = go 0 m1 m2
1471
1471
go s (BitmapIndexed b1 ls1) (BitmapIndexed b2 ls2) =
1472
1472
submapBitmapIndexed (go (s+ bitsPerSubkey)) b1 ls1 b2 ls2
1473
1473
go s (BitmapIndexed b1 ls1) (Full ls2) =
1474
- submapBitmapIndexed (go (s+ bitsPerSubkey)) b1 ls1 fullNodeMask ls2
1474
+ submapBitmapIndexed (go (s+ bitsPerSubkey)) b1 ls1 fullBitmap ls2
1475
1475
go s (Full ls1) (Full ls2) =
1476
- submapBitmapIndexed (go (s+ bitsPerSubkey)) fullNodeMask ls1 fullNodeMask ls2
1476
+ submapBitmapIndexed (go (s+ bitsPerSubkey)) fullBitmap ls1 fullBitmap ls2
1477
1477
1478
1478
-- Collision and Full nodes always contain at least two entries. Hence it
1479
1479
-- cannot be a map of a leaf.
@@ -1562,13 +1562,13 @@ unionWithKey f = go 0
1562
1562
ary' = unionArrayBy (go (s+ bitsPerSubkey)) b1 b2 ary1 ary2
1563
1563
in bitmapIndexedOrFull b' ary'
1564
1564
go s (BitmapIndexed b1 ary1) (Full ary2) =
1565
- let ary' = unionArrayBy (go (s+ bitsPerSubkey)) b1 fullNodeMask ary1 ary2
1565
+ let ary' = unionArrayBy (go (s+ bitsPerSubkey)) b1 fullBitmap ary1 ary2
1566
1566
in Full ary'
1567
1567
go s (Full ary1) (BitmapIndexed b2 ary2) =
1568
- let ary' = unionArrayBy (go (s+ bitsPerSubkey)) fullNodeMask b2 ary1 ary2
1568
+ let ary' = unionArrayBy (go (s+ bitsPerSubkey)) fullBitmap b2 ary1 ary2
1569
1569
in Full ary'
1570
1570
go s (Full ary1) (Full ary2) =
1571
- let ary' = unionArrayBy (go (s+ bitsPerSubkey)) fullNodeMask fullNodeMask
1571
+ let ary' = unionArrayBy (go (s+ bitsPerSubkey)) fullBitmap fullBitmap
1572
1572
ary1 ary2
1573
1573
in Full ary'
1574
1574
-- leaf vs. branch
@@ -1814,11 +1814,11 @@ intersectionWithKey# f = go 0
1814
1814
go s (BitmapIndexed b1 ary1) (BitmapIndexed b2 ary2) =
1815
1815
intersectionArrayBy (go (s + bitsPerSubkey)) b1 b2 ary1 ary2
1816
1816
go s (BitmapIndexed b1 ary1) (Full ary2) =
1817
- intersectionArrayBy (go (s + bitsPerSubkey)) b1 fullNodeMask ary1 ary2
1817
+ intersectionArrayBy (go (s + bitsPerSubkey)) b1 fullBitmap ary1 ary2
1818
1818
go s (Full ary1) (BitmapIndexed b2 ary2) =
1819
- intersectionArrayBy (go (s + bitsPerSubkey)) fullNodeMask b2 ary1 ary2
1819
+ intersectionArrayBy (go (s + bitsPerSubkey)) fullBitmap b2 ary1 ary2
1820
1820
go s (Full ary1) (Full ary2) =
1821
- intersectionArrayBy (go (s + bitsPerSubkey)) fullNodeMask fullNodeMask ary1 ary2
1821
+ intersectionArrayBy (go (s + bitsPerSubkey)) fullBitmap fullBitmap ary1 ary2
1822
1822
-- collision vs. branch
1823
1823
go s (BitmapIndexed b1 ary1) t2@ (Collision h2 _ls2)
1824
1824
| b1 .&. m2 == 0 = Empty
@@ -2081,7 +2081,7 @@ filterMapAux onLeaf onColl = go
2081
2081
| Just t' <- onLeaf t = t'
2082
2082
| otherwise = Empty
2083
2083
go (BitmapIndexed b ary) = filterA ary b
2084
- go (Full ary) = filterA ary fullNodeMask
2084
+ go (Full ary) = filterA ary fullBitmap
2085
2085
go (Collision h ary) = filterC ary h
2086
2086
2087
2087
filterA ary0 b0 =
@@ -2427,15 +2427,13 @@ sparseIndex
2427
2427
sparseIndex b m = popCount (b .&. (m - 1 ))
2428
2428
{-# INLINE sparseIndex #-}
2429
2429
2430
- -- TODO: Should be named _(bit)map_ instead of _mask_
2431
-
2432
2430
-- | A bitmap with the 'maxChildren' least significant bits set, i.e.
2433
2431
-- @0xFF_FF_FF_FF@.
2434
- fullNodeMask :: Bitmap
2432
+ fullBitmap :: Bitmap
2435
2433
-- This needs to use 'shiftL' instead of 'unsafeShiftL', to avoid UB.
2436
2434
-- See issue #412.
2437
- fullNodeMask = complement (complement 0 `shiftL` maxChildren)
2438
- {-# INLINE fullNodeMask #-}
2435
+ fullBitmap = complement (complement 0 `shiftL` maxChildren)
2436
+ {-# INLINE fullBitmap #-}
2439
2437
2440
2438
------------------------------------------------------------------------
2441
2439
-- Pointer equality
0 commit comments