1 /* -----------------------------------------------------------------------------
2 * $Id: MachDeps.h,v 1.6 2001/08/17 17:18:53 apt Exp $
4 * (c) The GRASP/AQUA Project, Glasgow University, 1998
5 * (c) The GHC Team, 1998-1999
7 * Definitions that characterise machine specific properties of basic
8 * Stg types provided as unboxed types (mirrors the typedefs in
11 * NB: THIS FILE IS INCLUDED IN HASKELL SOURCE!
12 * ---------------------------------------------------------------------------*/
21 #define CHAR_SIZE_IN_BYTES 1
22 #define ADDR_SIZE_IN_BYTES SIZEOF_VOID_P
23 #define INT_SIZE_IN_BYTES SIZEOF_LONG
24 #define WORD_SIZE_IN_BYTES SIZEOF_LONG
26 #ifndef WORD_SIZE_IN_BITS
27 #if WORD_SIZE_IN_BYTES == 4
28 #define WORD_SIZE_IN_BITS 32
30 #define WORD_SIZE_IN_BITS 64
34 #define FLOAT_SIZE_IN_BYTES SIZEOF_FLOAT
35 #define DOUBLE_SIZE_IN_BYTES SIZEOF_DOUBLE
37 #define SIZEOF_INT8 SIZEOF_CHAR
38 #define ALIGNMENT_INT8 ALIGNMENT_CHAR
39 #define SIZEOF_WORD8 SIZEOF_UNSIGNED_CHAR
40 #define ALIGNMENT_WORD8 ALIGNMENT_UNSIGNED_CHAR
42 #define SIZEOF_INT16 SIZEOF_SHORT
43 #define ALIGNMENT_INT16 ALIGNMENT_SHORT
44 #define SIZEOF_WORD16 SIZEOF_UNSIGNED_SHORT
45 #define ALIGNMENT_WORD16 ALIGNMENT_UNSIGNED_SHORT
47 #if SIZEOF_UNSIGNED_INT == 4
48 #define SIZEOF_INT32 SIZEOF_INT
49 #define ALIGNMENT_INT32 ALIGNMENT_INT
50 #define SIZEOF_WORD32 SIZEOF_UNSIGNED_INT
51 #define ALIGNMENT_WORD32 ALIGNMENT_UNSIGNED_INT
53 #error GHC untested on this architecture: sizeof(unsigned int) != 4
56 #if HAVE_LONG_LONG && SIZEOF_VOID_P < 8
57 /* assume long long is 64 bits */
58 #define SIZEOF_INT64 SIZEOF_LONG_LONG
59 #define ALIGNMENT_INT64 ALIGNMENT_LONG_LONG
60 #define SIZEOF_WORD64 SIZEOF_UNSIGNED_LONG_LONG
61 #define ALIGNMENT_WORD64 ALIGNMENT_UNSIGNED_LONG_LONG
62 #elif SIZEOF_LONG == 8
63 #define SIZEOF_INT64 SIZEOF_LONG
64 #define ALIGNMENT_INT64 ALIGNMENT_LONG
65 #define SIZEOF_WORD64 SIZEOF_UNSIGNED_LONG
66 #define ALIGNMENT_WORD64 ALIGNMENT_UNSIGNED_LONG
68 #error GHC untested on this architecture: sizeof(void *) < 8 and no long longs.