From 413e92e7c38d7addfb23816eda48ae0f8bef34c6 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 17 Jan 2024 13:58:52 +0100 Subject: [PATCH] support ghc 9.4 --- src/compiler/Data/Binary/Get.hs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/compiler/Data/Binary/Get.hs b/src/compiler/Data/Binary/Get.hs index 895789061c..a33c5c5a3a 100644 --- a/src/compiler/Data/Binary/Get.hs +++ b/src/compiler/Data/Binary/Get.hs @@ -101,6 +101,12 @@ import Data.STRef import GHC.Base import GHC.Word --import GHC.Int +#if MIN_VERSION_base(4,16,0) +import GHC.Exts (wordToWord16#, word16ToWord#, wordToWord32#, word32ToWord#) +#endif +#if __GLASGOW_HASKELL__ >= 900 +import GHC.Word (uncheckedShiftL64#) +#endif #endif -- Control.Monad.Fail import will become redundant in GHC 8.8+ @@ -532,8 +538,13 @@ shiftl_w32 :: Word32 -> Int -> Word32 shiftl_w64 :: Word64 -> Int -> Word64 #if defined(__GLASGOW_HASKELL__) && !defined(__HADDOCK__) +#if MIN_VERSION_base(4,16,0) +shiftl_w16 (W16# w) (I# i) = W16# (wordToWord16# ((word16ToWord# w) `uncheckedShiftL#` i)) +shiftl_w32 (W32# w) (I# i) = W32# (wordToWord32# ((word32ToWord# w) `uncheckedShiftL#` i)) +#else shiftl_w16 (W16# w) (I# i) = W16# (w `uncheckedShiftL#` i) shiftl_w32 (W32# w) (I# i) = W32# (w `uncheckedShiftL#` i) +#endif #if WORD_SIZE_IN_BITS < 64 shiftl_w64 (W64# w) (I# i) = W64# (w `uncheckedShiftL64#` i) @@ -545,7 +556,12 @@ foreign import ccall unsafe "stg_uncheckedShiftL64" #endif #else +#if __GLASGOW_HASKELL__ <= 810 shiftl_w64 (W64# w) (I# i) = W64# (w `uncheckedShiftL#` i) +#else +shiftl_w64 (W64# w) (I# i) = W64# (w `uncheckedShiftL64#` i) +#endif + #endif #else