2 % (c) The University of Glasgow, 2000-2006
4 \section{Fast integers and booleans}
8 FastInt, _ILIT, iBox, iUnbox,
9 (+#), (-#), (*#), quotFastInt, negateFastInt,
10 (==#), (<#), (<=#), (>=#), (>#),
12 FastBool, fastBool, isFastTrue, fastOr, fastAnd
15 #include "HsVersions.h"
17 #if defined(__GLASGOW_HASKELL__)
21 ( Int(..), Int#, (+#), (-#), (*#),
22 quotInt#, negateInt#, (==#), (<#), (<=#), (>=#), (>#)
29 quotFastInt = quotInt#
30 negateFastInt = negateInt#
35 isFastTrue x = x ==# 1#
37 -- note that fastOr and fastAnd are strict in both arguments
38 -- since they are unboxed
45 #else /* ! __GLASGOW_HASKELL__ */
55 negateFastInt = negate
65 -- make sure these are as strict as the unboxed version,
66 -- so that the performance characteristics match
67 fastOr False False = False
69 fastAnd True True = True
72 --These are among the type-signatures necessary for !ghc to compile
73 -- but break ghc (can't give a signature for an import...)
74 --Note that the comparisons actually do return Bools not FastBools.
75 (+#) :: FastInt -> FastInt -> FastInt
76 (-#) :: FastInt -> FastInt -> FastInt
77 (*#) :: FastInt -> FastInt -> FastInt
78 (==#) :: FastInt -> FastInt -> Bool
79 (<#) :: FastInt -> FastInt -> Bool
80 (<=#) :: FastInt -> FastInt -> Bool
81 (>=#) :: FastInt -> FastInt -> Bool
82 (>#) :: FastInt -> FastInt -> Bool
84 #endif /* ! __GLASGOW_HASKELL__ */
86 -- type-signatures will improve the non-ghc-specific versions
87 -- and keep things accurate (and ABLE to compile!)
88 _ILIT :: Int -> FastInt
89 iBox :: FastInt -> Int
90 iUnbox :: Int -> FastInt
92 quotFastInt :: FastInt -> FastInt -> FastInt
93 negateFastInt :: FastInt -> FastInt
95 fastBool :: Bool -> FastBool
96 isFastTrue :: FastBool -> Bool
97 fastOr :: FastBool -> FastBool -> FastBool
98 fastAnd :: FastBool -> FastBool -> FastBool