remove empty dir
[ghc-hetmet.git] / compiler / utils / FastTypes.lhs
1 %
2 % (c) The University of Glasgow, 2000
3 %
4 \section{Fast integers and booleans}
5
6 \begin{code}
7 module FastTypes (
8     FastInt, _ILIT, iBox, iUnbox,
9     (+#), (-#), (*#), quotFastInt, negateFastInt,
10     (==#), (<#), (<=#), (>=#), (>#),
11
12     FastBool, fastBool, isFastTrue, fastOr, fastAnd
13   ) where
14
15 #include "HsVersions.h"
16
17 #if defined(__GLASGOW_HASKELL__)
18
19 -- Import the beggars
20 import GLAEXTS
21         ( Int(..), Int#, (+#), (-#), (*#), 
22           quotInt#, negateInt#, (==#), (<#), (<=#), (>=#), (>#)
23         )
24
25 type FastInt = Int#
26 _ILIT (I# x) = x
27 iBox x = I# x
28 iUnbox (I# x) = x
29 quotFastInt   = quotInt#
30 negateFastInt = negateInt#
31
32 type FastBool = Int#
33 fastBool True  = 1#
34 fastBool False = 0#
35 isFastTrue x = x ==# 1#
36
37 fastOr 1# _ = 1#
38 fastOr 0# x = x
39
40 fastAnd 0# x = 0#
41 fastAnd 1# x = x
42
43 #else /* ! __GLASGOW_HASKELL__ */
44
45 type FastInt = Int
46 _ILIT x = x
47 iBox x = x
48 iUnbox x = x
49 (+#) = (+)
50 (-#) = (-)
51 (*#) = (*)
52 quotFastInt   = quot
53 negateFastInt = negate
54 (==#) = (==)
55 (<#)  = (<)
56 (<=#) = (<=)
57 (>=#) = (>=)
58 (>#)  = (>)
59
60 type FastBool = Bool
61 fastBool x = x
62 _IS_TRUE_ x = x
63
64 #endif /* ! __GLASGOW_HASKELL__ */
65 \end{code}