48c54e8ac1cf8e085824e61ff31941308f93ff70
[ghc-hetmet.git] / ghc / includes / MachDeps.h
1 /* -----------------------------------------------------------------------------
2  * $Id: MachDeps.h,v 1.4 2000/01/25 14:39:14 panne Exp $
3  *
4  * (c) The GRASP/AQUA Project, Glasgow University, 1998
5  * (c) The GHC Team, 1998-1999
6  * 
7  * Definitions that characterise machine specific properties of basic
8  * Stg types provided as unboxed types (mirrors the typedefs in
9  * StgTypes.)
10  *
11  * NB: THIS FILE IS INCLUDED IN HASKELL SOURCE!
12  * ---------------------------------------------------------------------------*/
13
14 #ifndef MACHDEPS_H
15 #define MACHDEPS_H
16
17 #include "config.h"
18
19 #define CHAR_SIZE_IN_BYTES      1
20 #define ADDR_SIZE_IN_BYTES      SIZEOF_VOID_P
21 #define INT_SIZE_IN_BYTES       SIZEOF_LONG
22 #define WORD_SIZE_IN_BYTES      SIZEOF_LONG
23
24 #if SIZEOF_DOUBLE == SIZEOF_VOID_P
25 #define FLOAT_SIZE_IN_BYTES     SIZEOF_DOUBLE
26 #define DOUBLE_SIZE_IN_BYTES    SIZEOF_DOUBLE
27 #else
28 #define FLOAT_SIZE_IN_BYTES     SIZEOF_FLOAT
29 #define DOUBLE_SIZE_IN_BYTES    SIZEOF_DOUBLE
30 #endif
31
32 #define SIZEOF_INT8             SIZEOF_CHAR
33 #define ALIGNMENT_INT8          ALIGNMENT_CHAR
34 #define SIZEOF_WORD8            SIZEOF_UNSIGNED_CHAR
35 #define ALIGNMENT_WORD8         ALIGNMENT_UNSIGNED_CHAR
36
37 #define SIZEOF_INT16            SIZEOF_SHORT
38 #define ALIGNMENT_INT16         ALIGNMENT_SHORT
39 #define SIZEOF_WORD16           SIZEOF_UNSIGNED_SHORT
40 #define ALIGNMENT_WORD16        ALIGNMENT_UNSIGNED_SHORT
41
42 #if SIZEOF_UNSIGNED_INT == 4
43 #define SIZEOF_INT32            ALIGNMENT_INT
44 #define ALIGNMENT_INT32         SIZEOF_INT
45 #define SIZEOF_WORD32           ALIGNMENT_UNSIGNED_INT
46 #define ALIGNMENT_WORD32        SIZEOF_UNSIGNED_INT
47 #else
48 #error GHC untested on this architecture: sizeof(unsigned int) != 4
49 #endif
50
51 #if HAVE_LONG_LONG && SIZEOF_VOID_P < 8
52 /* assume long long is 64 bits */
53 #define SIZEOF_INT64            SIZEOF_LONG_LONG
54 #define ALIGNMENT_INT64         ALIGNMENT_LONG_LONG
55 #define SIZEOF_WORD64           SIZEOF_UNSIGNED_LONG_LONG
56 #define ALIGNMENT_WORD64        ALIGNMENT_UNSIGNED_LONG_LONG
57 #elif SIZEOF_LONG == 8
58 #define SIZEOF_INT64            SIZEOF_LONG
59 #define ALIGNMENT_INT64         ALIGNMENT_LONG
60 #define SIZEOF_WORD64           SIZEOF_UNSIGNED_LONG
61 #define ALIGNMENT_WORD64        ALIGNMENT_UNSIGNED_LONG
62 #else
63 #error GHC untested on this architecture: sizeof(void *) < 8 and no long longs.
64 #endif
65
66 #endif