[Git][ghc/ghc][wip/T22010] Fix the Word64Map/Set issue

Jaro Reinders (@Noughtmare) gitlab at gitlab.haskell.org
Tue Jun 20 16:12:54 UTC 2023



Jaro Reinders pushed to branch wip/T22010 at Glasgow Haskell Compiler / GHC


Commits:
48dffdf3 by Jaro Reinders at 2023-06-20T18:12:42+02:00
Fix the Word64Map/Set issue

- - - - -


1 changed file:

- compiler/GHC/Utils/Containers/Internal/BitUtil.hs


Changes:

=====================================
compiler/GHC/Utils/Containers/Internal/BitUtil.hs
=====================================
@@ -35,11 +35,10 @@ module GHC.Utils.Containers.Internal.BitUtil
     , highestBitMask
     , shiftLL
     , shiftRL
-    , wordSize
     ) where
 
 import Data.Bits (popCount, unsafeShiftL, unsafeShiftR
-    , countLeadingZeros, finiteBitSize
+    , countLeadingZeros
     )
 import Prelude
 import Data.Word
@@ -66,14 +65,10 @@ bitcount a x = a + popCount x
 
 -- | Return a word where only the highest bit is set.
 highestBitMask :: Word64 -> Word64
-highestBitMask w = shiftLL 1 (wordSize - 1 - countLeadingZeros w)
+highestBitMask w = shiftLL 1 (63 - countLeadingZeros w)
 {-# INLINE highestBitMask #-}
 
 -- Right and left logical shifts.
 shiftRL, shiftLL :: Word64 -> Int -> Word64
 shiftRL = unsafeShiftR
-shiftLL = unsafeShiftL
-
-{-# INLINE wordSize #-}
-wordSize :: Int
-wordSize = finiteBitSize (0 :: Word)
+shiftLL = unsafeShiftL
\ No newline at end of file



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/48dffdf3e63e0a1c40fda21dc37cdbf4cae8c2a6

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/48dffdf3e63e0a1c40fda21dc37cdbf4cae8c2a6
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230620/9c952b55/attachment-0001.html>


More information about the ghc-commits mailing list