X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=GHC%2FWord.hs;h=0c9741d4d6a99e78bc78e987a674bb92e565c746;hb=a2a70b9bf60672c72b35654105402cf21238b6f4;hp=87b6e63aefaa7e0e99c62fa5c3180d887324dc2c;hpb=3a540635e558efbd275ae8bfa4326f5adfa96208;p=haskell-directory.git diff --git a/GHC/Word.hs b/GHC/Word.hs index 87b6e63..0c9741d 100644 --- a/GHC/Word.hs +++ b/GHC/Word.hs @@ -164,7 +164,7 @@ instance Bits Word where | otherwise = W# (x# `shiftRL#` negateInt# i#) (W# x#) `rotate` (I# i#) | i'# ==# 0# = W# x# - | otherwise = W# ((x# `shiftL#` i'#) `or#` (x# `shiftRL#` (wsib -# i'#))) + | otherwise = W# ((x# `uncheckedShiftL#` i'#) `or#` (x# `uncheckedShiftRL#` (wsib -# i'#))) where i'# = word2Int# (int2Word# i# `and#` int2Word# (wsib -# 1#)) wsib = WORD_SIZE_IN_BITS# {- work around preprocessor problem (??) -} @@ -264,8 +264,8 @@ instance Bits Word8 where | otherwise = W8# (x# `shiftRL#` negateInt# i#) (W8# x#) `rotate` (I# i#) | i'# ==# 0# = W8# x# - | otherwise = W8# (narrow8Word# ((x# `shiftL#` i'#) `or#` - (x# `shiftRL#` (8# -# i'#)))) + | otherwise = W8# (narrow8Word# ((x# `uncheckedShiftL#` i'#) `or#` + (x# `uncheckedShiftRL#` (8# -# i'#)))) where i'# = word2Int# (int2Word# i# `and#` int2Word# 7#) bitSize _ = 8 @@ -365,8 +365,8 @@ instance Bits Word16 where | otherwise = W16# (x# `shiftRL#` negateInt# i#) (W16# x#) `rotate` (I# i#) | i'# ==# 0# = W16# x# - | otherwise = W16# (narrow16Word# ((x# `shiftL#` i'#) `or#` - (x# `shiftRL#` (16# -# i'#)))) + | otherwise = W16# (narrow16Word# ((x# `uncheckedShiftL#` i'#) `or#` + (x# `uncheckedShiftRL#` (16# -# i'#)))) where i'# = word2Int# (int2Word# i# `and#` int2Word# 15#) bitSize _ = 16 @@ -595,8 +595,8 @@ instance Bits Word32 where | otherwise = W32# (x# `shiftRL#` negateInt# i#) (W32# x#) `rotate` (I# i#) | i'# ==# 0# = W32# x# - | otherwise = W32# (narrow32Word# ((x# `shiftL#` i'#) `or#` - (x# `shiftRL#` (32# -# i'#)))) + | otherwise = W32# (narrow32Word# ((x# `uncheckedShiftL#` i'#) `or#` + (x# `uncheckedShiftRL#` (32# -# i'#)))) where i'# = word2Int# (int2Word# i# `and#` int2Word# 31#) bitSize _ = 32 @@ -745,31 +745,31 @@ a `shiftRL64#` b | b >=# 64# = wordToWord64# (int2Word# 0#) | otherwise = a `uncheckedShiftRL64#` b -foreign import ccall unsafe "stg_eqWord64" eqWord64# :: Word64# -> Word64# -> Bool -foreign import ccall unsafe "stg_neWord64" neWord64# :: Word64# -> Word64# -> Bool -foreign import ccall unsafe "stg_ltWord64" ltWord64# :: Word64# -> Word64# -> Bool -foreign import ccall unsafe "stg_leWord64" leWord64# :: Word64# -> Word64# -> Bool -foreign import ccall unsafe "stg_gtWord64" gtWord64# :: Word64# -> Word64# -> Bool -foreign import ccall unsafe "stg_geWord64" geWord64# :: Word64# -> Word64# -> Bool -foreign import ccall unsafe "stg_int64ToWord64" int64ToWord64# :: Int64# -> Word64# -foreign import ccall unsafe "stg_word64ToInt64" word64ToInt64# :: Word64# -> Int64# -foreign import ccall unsafe "stg_intToInt64" intToInt64# :: Int# -> Int64# -foreign import ccall unsafe "stg_wordToWord64" wordToWord64# :: Word# -> Word64# -foreign import ccall unsafe "stg_word64ToWord" word64ToWord# :: Word64# -> Word# -foreign import ccall unsafe "stg_plusInt64" plusInt64# :: Int64# -> Int64# -> Int64# -foreign import ccall unsafe "stg_minusInt64" minusInt64# :: Int64# -> Int64# -> Int64# -foreign import ccall unsafe "stg_timesInt64" timesInt64# :: Int64# -> Int64# -> Int64# -foreign import ccall unsafe "stg_negateInt64" negateInt64# :: Int64# -> Int64# -foreign import ccall unsafe "stg_quotWord64" quotWord64# :: Word64# -> Word64# -> Word64# -foreign import ccall unsafe "stg_remWord64" remWord64# :: Word64# -> Word64# -> Word64# -foreign import ccall unsafe "stg_and64" and64# :: Word64# -> Word64# -> Word64# -foreign import ccall unsafe "stg_or64" or64# :: Word64# -> Word64# -> Word64# -foreign import ccall unsafe "stg_xor64" xor64# :: Word64# -> Word64# -> Word64# -foreign import ccall unsafe "stg_not64" not64# :: Word64# -> Word64# -foreign import ccall unsafe "stg_uncheckedShiftL64" uncheckedShiftL64# :: Word64# -> Int# -> Word64# -foreign import ccall unsafe "stg_uncheckedShiftRL64" uncheckedShiftRL64# :: Word64# -> Int# -> Word64# - -foreign import ccall unsafe "stg_integerToWord64" integerToWord64# :: Int# -> ByteArray# -> Word64# +foreign import ccall unsafe "hs_eqWord64" eqWord64# :: Word64# -> Word64# -> Bool +foreign import ccall unsafe "hs_neWord64" neWord64# :: Word64# -> Word64# -> Bool +foreign import ccall unsafe "hs_ltWord64" ltWord64# :: Word64# -> Word64# -> Bool +foreign import ccall unsafe "hs_leWord64" leWord64# :: Word64# -> Word64# -> Bool +foreign import ccall unsafe "hs_gtWord64" gtWord64# :: Word64# -> Word64# -> Bool +foreign import ccall unsafe "hs_geWord64" geWord64# :: Word64# -> Word64# -> Bool +foreign import ccall unsafe "hs_int64ToWord64" int64ToWord64# :: Int64# -> Word64# +foreign import ccall unsafe "hs_word64ToInt64" word64ToInt64# :: Word64# -> Int64# +foreign import ccall unsafe "hs_intToInt64" intToInt64# :: Int# -> Int64# +foreign import ccall unsafe "hs_wordToWord64" wordToWord64# :: Word# -> Word64# +foreign import ccall unsafe "hs_word64ToWord" word64ToWord# :: Word64# -> Word# +foreign import ccall unsafe "hs_plusInt64" plusInt64# :: Int64# -> Int64# -> Int64# +foreign import ccall unsafe "hs_minusInt64" minusInt64# :: Int64# -> Int64# -> Int64# +foreign import ccall unsafe "hs_timesInt64" timesInt64# :: Int64# -> Int64# -> Int64# +foreign import ccall unsafe "hs_negateInt64" negateInt64# :: Int64# -> Int64# +foreign import ccall unsafe "hs_quotWord64" quotWord64# :: Word64# -> Word64# -> Word64# +foreign import ccall unsafe "hs_remWord64" remWord64# :: Word64# -> Word64# -> Word64# +foreign import ccall unsafe "hs_and64" and64# :: Word64# -> Word64# -> Word64# +foreign import ccall unsafe "hs_or64" or64# :: Word64# -> Word64# -> Word64# +foreign import ccall unsafe "hs_xor64" xor64# :: Word64# -> Word64# -> Word64# +foreign import ccall unsafe "hs_not64" not64# :: Word64# -> Word64# +foreign import ccall unsafe "hs_uncheckedShiftL64" uncheckedShiftL64# :: Word64# -> Int# -> Word64# +foreign import ccall unsafe "hs_uncheckedShiftRL64" uncheckedShiftRL64# :: Word64# -> Int# -> Word64# + +foreign import ccall unsafe "hs_integerToWord64" integerToWord64# :: Int# -> ByteArray# -> Word64# {-# RULES @@ -856,8 +856,8 @@ instance Bits Word64 where | otherwise = W64# (x# `shiftRL#` negateInt# i#) (W64# x#) `rotate` (I# i#) | i'# ==# 0# = W64# x# - | otherwise = W64# ((x# `shiftL#` i'#) `or#` - (x# `shiftRL#` (64# -# i'#))) + | otherwise = W64# ((x# `uncheckedShiftL#` i'#) `or#` + (x# `uncheckedShiftRL#` (64# -# i'#))) where i'# = word2Int# (int2Word# i# `and#` int2Word# 63#) bitSize _ = 64