[project @ 2001-07-19 09:01:40 by simonmar]
[ghc-hetmet.git] / ghc / includes / MachDeps.h
1 /* -----------------------------------------------------------------------------
2  * $Id: MachDeps.h,v 1.5 2001/07/19 09:01:40 simonmar 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 #define FLOAT_SIZE_IN_BYTES     SIZEOF_FLOAT
25 #define DOUBLE_SIZE_IN_BYTES    SIZEOF_DOUBLE
26
27 #define SIZEOF_INT8             SIZEOF_CHAR
28 #define ALIGNMENT_INT8          ALIGNMENT_CHAR
29 #define SIZEOF_WORD8            SIZEOF_UNSIGNED_CHAR
30 #define ALIGNMENT_WORD8         ALIGNMENT_UNSIGNED_CHAR
31
32 #define SIZEOF_INT16            SIZEOF_SHORT
33 #define ALIGNMENT_INT16         ALIGNMENT_SHORT
34 #define SIZEOF_WORD16           SIZEOF_UNSIGNED_SHORT
35 #define ALIGNMENT_WORD16        ALIGNMENT_UNSIGNED_SHORT
36
37 #if SIZEOF_UNSIGNED_INT == 4
38 #define SIZEOF_INT32            ALIGNMENT_INT
39 #define ALIGNMENT_INT32         SIZEOF_INT
40 #define SIZEOF_WORD32           ALIGNMENT_UNSIGNED_INT
41 #define ALIGNMENT_WORD32        SIZEOF_UNSIGNED_INT
42 #else
43 #error GHC untested on this architecture: sizeof(unsigned int) != 4
44 #endif
45
46 #if HAVE_LONG_LONG && SIZEOF_VOID_P < 8
47 /* assume long long is 64 bits */
48 #define SIZEOF_INT64            SIZEOF_LONG_LONG
49 #define ALIGNMENT_INT64         ALIGNMENT_LONG_LONG
50 #define SIZEOF_WORD64           SIZEOF_UNSIGNED_LONG_LONG
51 #define ALIGNMENT_WORD64        ALIGNMENT_UNSIGNED_LONG_LONG
52 #elif SIZEOF_LONG == 8
53 #define SIZEOF_INT64            SIZEOF_LONG
54 #define ALIGNMENT_INT64         ALIGNMENT_LONG
55 #define SIZEOF_WORD64           SIZEOF_UNSIGNED_LONG
56 #define ALIGNMENT_WORD64        ALIGNMENT_UNSIGNED_LONG
57 #else
58 #error GHC untested on this architecture: sizeof(void *) < 8 and no long longs.
59 #endif
60
61 #endif