2 % (c) The University of Glasgow, 2000-2006
4 \section{Fast booleans}
8 FastBool, fastBool, isFastTrue, fastOr, fastAnd
11 #if defined(__GLASGOW_HASKELL__)
15 ( Int(..), Int#, (+#), (-#), (*#),
16 quotInt#, negateInt#, (==#), (<#), (<=#), (>=#), (>#)
23 isFastTrue x = x ==# 1#
25 -- note that fastOr and fastAnd are strict in both arguments
26 -- since they are unboxed
29 fastOr _ _ = panic# "FastTypes: fastOr"
33 fastAnd _ _ = panic# "FastTypes: fastAnd"
35 #else /* ! __GLASGOW_HASKELL__ */
40 -- make sure these are as strict as the unboxed version,
41 -- so that the performance characteristics match
42 fastOr False False = False
44 fastAnd True True = True
47 #endif /* ! __GLASGOW_HASKELL__ */
49 fastBool :: Bool -> FastBool
50 isFastTrue :: FastBool -> Bool
51 fastOr :: FastBool -> FastBool -> FastBool
52 fastAnd :: FastBool -> FastBool -> FastBool