[commit: packages/containers] master, revert-408-bugfix_394: commenting out bitmapForBin for now, so things work. (ff975b7)

git at git.haskell.org git at git.haskell.org
Mon Apr 17 21:48:19 UTC 2017


Repository : ssh://git@git.haskell.org/containers

On branches: master,revert-408-bugfix_394
Link       : http://git.haskell.org/packages/containers.git/commitdiff/ff975b713a04c8ede2238df65c6c0f06d52b19f4

>---------------------------------------------------------------

commit ff975b713a04c8ede2238df65c6c0f06d52b19f4
Author: wren romano <wren at community.haskell.org>
Date:   Wed Feb 15 23:07:59 2017 -0800

    commenting out bitmapForBin for now, so things work.


>---------------------------------------------------------------

ff975b713a04c8ede2238df65c6c0f06d52b19f4
 Data/IntMap/Internal.hs | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs
index cd0bb65..c987bdd 100644
--- a/Data/IntMap/Internal.hs
+++ b/Data/IntMap/Internal.hs
@@ -1153,13 +1153,19 @@ lookupPrefix _ Nil = Nil
 
 
 restrictBM :: IntSetBitMap -> IntMap a -> IntMap a
+{-
+-- See note below about 'bitmapForBin'.
 restrictBM 0 _ = Nil
+-}
 restrictBM bm (Bin p m l r) =
-    -- Assuming 'bitmapForBin' actually works correctly...
+    {-
+    -- Assuming 'bitmapForBin' actually worked correctly, this would let us short-circuit by hitting the 0 case above.
     let m'  = intFromNat (natFromInt m `shiftRL` 1)
         bmL = bitmapForBin p m'
         bmR = bitmapForBin (p .|. m) m'
     in bin p m (restrictBM bmL l) (restrictBM bmR r)
+    -}
+    bin p m (restrictBM bm l) (restrictBM bm r)
 restrictBM bm t@(Tip k _)
     -- TODO(wrengr): need we manually inline 'IntSet.Member' here?
     | k `IntSet.member` IntSet.Tip (k .&. IntSet.prefixBitMask) bm = t
@@ -1167,6 +1173,7 @@ restrictBM bm t@(Tip k _)
 restrictBM _ Nil = Nil
 
 
+{-
 -- TODO(wrengr): this is buggy somehow.
 -- | Return an `IntSet`-bitmap for all keys that could possibly be
 -- contained in an `IntMap`-`Bin` with the given prefix and switching
@@ -1192,6 +1199,7 @@ bitmapForBin p m =
     bitmapOf i = shiftLL 1 (i .&. IntSet.suffixBitMask)
     {-# INLINE bitmapOf #-}
 {-# INLINE bitmapForBin #-}
+-}
 
 
 -- | /O(n+m)/. The intersection with a combining function.



More information about the ghc-commits mailing list