summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Dupree <id@isaac.cedarswampstudios.org>2007-04-30 19:58:10 +0000
committerIsaac Dupree <id@isaac.cedarswampstudios.org>2007-04-30 19:58:10 +0000
commitcc89fbedbf65d7bebbc790796290ed5a4590c868 (patch)
tree107c3c61f285c7a7dd472fa29a5ba1fbae1bb1b1
parentda72bd5d852ac0e01a00f5d54030a958fbcf72dc (diff)
downloadhaskell-cc89fbedbf65d7bebbc790796290ed5a4590c868.tar.gz
FastTypes - note strictness of fast{Or,And} and make the unboxed versions so
-rw-r--r--compiler/utils/FastTypes.lhs10
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/utils/FastTypes.lhs b/compiler/utils/FastTypes.lhs
index bcea61de78..9d7c276c22 100644
--- a/compiler/utils/FastTypes.lhs
+++ b/compiler/utils/FastTypes.lhs
@@ -34,6 +34,8 @@ fastBool True = 1#
fastBool False = 0#
isFastTrue x = x ==# 1#
+-- note that fastOr and fastAnd are strict in both arguments
+-- since they are unboxed
fastOr 1# _ = 1#
fastOr 0# x = x
@@ -60,8 +62,12 @@ negateFastInt = negate
type FastBool = Bool
fastBool x = x
isFastTrue x = x
-fastOr = (||)
-fastAnd = (&&)
+-- make sure these are as strict as the unboxed version,
+-- so that the performance characteristics match
+fastOr False False = False
+fastOr _ _ = True
+fastAnd True True = True
+fastAnd _ _ = False
--These are among the type-signatures necessary for !ghc to compile
-- but break ghc (can't give a signature for an import...)