2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
8 #include <exec/types.h>
9 #include <aros/config.h>
11 struct __aros_longalign
17 struct __aros_wordalign
23 struct __aros_ptralign
29 struct __aros_iptralign
35 struct __aros_doublealign
43 char b
; /* This MUST NOT BE static ! */
62 /* Calculate the addresses of two *local* variables */
66 /* If this is a normal stack, memory looks like this:
72 because adr1 (a) is pushed on the stack and the stackpointer
73 is decreased (*--sp=a). Otherwise it looks like:
81 The difference between big and little endian is this:
83 Big endian stores the value 0x11223344 as { 0x11, 0x22, 0x33, 0x44 }
84 (ie. the first byte in memory is the most significant byte of the
87 Little endian stores the value 0x11223344 as { 0x44, 0x33, 0x22, 0x11 }
88 (ie. the first byte in memory is the least significant byte of the
94 first_byte
= (char *)&val
; /* Check if the first byte is 0x11 */
96 wordalign
= offsetof(struct __aros_wordalign
, offset
);
97 longalign
= offsetof(struct __aros_longalign
, offset
);
98 ptralign
= offsetof(struct __aros_ptralign
, offset
);
99 iptralign
= offsetof(struct __aros_iptralign
, offset
);
100 doublealign
= offsetof(struct __aros_doublealign
, offset
);
102 worstalign
= wordalign
;
103 if (worstalign
< longalign
) worstalign
= longalign
;
104 if (worstalign
< ptralign
) worstalign
= ptralign
;
105 if (worstalign
< iptralign
) worstalign
= iptralign
;
106 if (worstalign
< doublealign
) worstalign
= doublealign
;
108 #if (AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT)
109 if (worstalign
< 8) worstalign
= 8;
112 printf ("#define AROS_STACK_GROWS_DOWNWARDS %d /* Stack direction */\n", (adr2
< adr1
));
113 printf ("#define AROS_BIG_ENDIAN %d /* Big or little endian */\n", (*first_byte
== 0x11));
114 printf ("#define AROS_SIZEOFULONG %ld /* Size of an ULONG */\n", (unsigned long)sizeof (ULONG
));
115 printf ("#define AROS_WORDALIGN %d /* Alignment for WORD */\n", wordalign
);
116 printf ("#define AROS_LONGALIGN %d /* Alignment for LONG */\n", longalign
);
117 printf ("#define AROS_PTRALIGN %d /* Alignment for PTR */\n", ptralign
);
118 printf ("#define AROS_IPTRALIGN %d /* Alignment for IPTR */\n", iptralign
);
119 printf ("#define AROS_DOUBLEALIGN %d /* Alignment for double */\n", doublealign
);
120 printf ("#define AROS_WORSTALIGN %d /* Worst case alignment */\n", worstalign
);