summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ericson <git@JohnEricson.me>2020-08-30 18:49:53 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2021-12-17 11:29:20 -0500
commit502953145f05f87dd29582b8e4b7570d2efebadc (patch)
treeafd936cdc4aecef8776b464ab42df3d9fa1c14c0
parent10ee365978553395496a33dd766eb39c0f9758b5 (diff)
downloadhaskell-wip/int64-everywhere.tar.gz
`integerFromInt64#` can be inlined when the word size is >= 64 bitswip/int64-everywhere
Maybe this will help with the renaming test failure?
-rw-r--r--libraries/ghc-bignum/src/GHC/Num/Integer.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/libraries/ghc-bignum/src/GHC/Num/Integer.hs b/libraries/ghc-bignum/src/GHC/Num/Integer.hs
index 810ce7f050..ff264435a0 100644
--- a/libraries/ghc-bignum/src/GHC/Num/Integer.hs
+++ b/libraries/ghc-bignum/src/GHC/Num/Integer.hs
@@ -1002,6 +1002,7 @@ integerIsPowerOf2# (IP w) = bigNatIsPowerOf2# w
integerFromInt64# :: Int64# -> Integer
{-# NOINLINE integerFromInt64# #-}
integerFromInt64# i
+#if WORD_SIZE_IN_BITS < 64
| isTrue# ((i `leInt64#` intToInt64# INT_MAXBOUND#)
&&# (i `geInt64#` intToInt64# INT_MINBOUND#))
= IS (int64ToInt# i)
@@ -1011,6 +1012,11 @@ integerFromInt64# i
| True
= IN (bigNatFromWord64# (int64ToWord64# (negateInt64# i)))
+{-# NOINLINE integerFromInt64# #-}
+#else
+ = IS (int64ToInt# i)
+{-# INLINE integerFromInt64# #-}
+#endif
-- | Convert a Word64# into an Integer
integerFromWord64# :: Word64# -> Integer