1 /* This file is part of psim (model of the PowerPC(tm) architecture)
3 Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License
7 as published by the Free Software Foundation; either version 2 of
8 the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 PowerPC is a trademark of International Business Machines Corporation. */
24 /* Basic type sizes for the PowerPC */
32 /* INTEGER QUANTITIES:
36 natural* sign determined by host
37 signed* signed type of the given size
38 unsigned* The corresponding insigned type
42 *NN Size based on the number of bits
43 *_NN Size according to the number of bytes
44 *_word Size based on the target architecture's word
45 word size (32/64 bits)
46 *_cell Size based on the target architecture's
47 IEEE 1275 cell size (almost always 32 bits)
53 typedef char natural8;
54 typedef short natural16;
55 typedef long natural32;
57 typedef signed char signed8;
58 typedef signed short signed16;
59 typedef signed long signed32;
61 typedef unsigned char unsigned8;
62 typedef unsigned short unsigned16;
63 typedef unsigned long unsigned32;
65 #if defined __GNUC__ || defined _MSC_VER
68 typedef long long natural64;
69 typedef signed long long signed64;
70 typedef unsigned long long unsigned64;
72 #define UNSIGNED64(X) (X##ULL)
73 #define SIGNED64(X) (X##LL)
75 #define UNSIGNED32(X) (X##UL)
76 #define SIGNED32(X) (X##L)
80 typedef __int64 natural64;
81 typedef signed __int64 signed64;
82 typedef unsigned __int64 unsigned64;
84 #define UNSIGNED64(X) (X##ui64)
85 #define SIGNED64(X) (X##i64)
87 #define SIGNED32(X) (X##ui32)
88 #define UNSIGNED32(X) (X##i32)
92 typedef struct { unsigned64 a[2]; } unsigned128;
93 typedef struct { signed64 a[2]; } signed128;
95 #else /* Not GNUC or _MSC_VER */
100 typedef natural8 natural_1;
101 typedef natural16 natural_2;
102 typedef natural32 natural_4;
103 typedef natural64 natural_8;
104 /* typedef natural64 natural_8; */
106 typedef signed8 signed_1;
107 typedef signed16 signed_2;
108 typedef signed32 signed_4;
109 typedef signed64 signed_8;
110 typedef signed128 signed_16;
112 typedef unsigned8 unsigned_1;
113 typedef unsigned16 unsigned_2;
114 typedef unsigned32 unsigned_4;
115 typedef unsigned64 unsigned_8;
116 typedef unsigned128 unsigned_16;
119 /* for general work, the following are defined */
120 /* unsigned: >= 32 bits */
121 /* signed: >= 32 bits */
122 /* long: >= 32 bits, sign undefined */
123 /* int: small indicator */
125 /* target architecture based */
126 #if (WITH_TARGET_WORD_BITSIZE == 64)
127 typedef natural64 natural_word;
128 typedef unsigned64 unsigned_word;
129 typedef signed64 signed_word;
131 #if (WITH_TARGET_WORD_BITSIZE == 32)
132 typedef natural32 natural_word;
133 typedef unsigned32 unsigned_word;
134 typedef signed32 signed_word;
138 /* Other instructions */
139 #if (WITH_TARGET_ADDRESS_BITSIZE == 64)
140 typedef unsigned64 address_word;
142 #if (WITH_TARGET_ADDRESS_BITSIZE == 32)
143 typedef unsigned32 address_word;
146 /* IEEE 1275 cell size */
147 #if (WITH_TARGET_CELL_BITSIZE == 64)
148 typedef natural64 natural_cell;
149 typedef unsigned64 unsigned_cell;
150 typedef signed64 signed_cell;
152 #if (WITH_TARGET_CELL_BITSIZE == 32)
153 typedef natural32 natural_cell;
154 typedef unsigned32 unsigned_cell;
155 typedef signed32 signed_cell;
158 #endif /* _SIM_TYPES_H_ */