Define SIGNED64 and UNSIGNED64 macros - handle MSC/GCC LL issue.
[external/binutils.git] / sim / common / sim-types.h
1 /* This file is part of psim (model of the PowerPC(tm) architecture)
2
3    Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
4    Copyright (C) 1997, Free Software Foundation, Inc.
5
6    This library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Library General Public License
8    as published by the Free Software Foundation; either version 2 of
9    the License, or (at your option) any later version.
10  
11    This library is distributed in the hope that it will be useful, but
12    WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Library General Public License for more details.
15  
16    You should have received a copy of the GNU Library General Public
17    License along with this library; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  
20    --
21
22    PowerPC is a trademark of International Business Machines Corporation. */
23
24
25 /* Basic type sizes for the PowerPC */
26
27 #ifndef _SIM_TYPES_H_
28 #define _SIM_TYPES_H_
29
30
31
32
33 /* INTEGER QUANTITIES:
34
35    TYPES:
36
37      natural*   sign determined by host
38      signed*    signed type of the given size
39      unsigned*  The corresponding insigned type
40
41    SIZES
42
43      *NN        Size based on the number of bits
44      *_NN       Size according to the number of bytes
45      *_word     Size based on the target architecture's word
46                 word size (32/64 bits)
47      *_cell     Size based on the target architecture's
48                 IEEE 1275 cell size (almost always 32 bits)
49
50 */
51
52
53 /* bit based */
54 typedef char natural8;
55 typedef short natural16;
56 typedef long natural32;
57
58 typedef signed char signed8;
59 typedef signed short signed16;
60 typedef signed long signed32;
61
62 typedef unsigned char unsigned8;
63 typedef unsigned short unsigned16;
64 typedef unsigned long unsigned32;
65
66 #if defined __GNUC__ || defined _WIN32
67 #ifdef __GNUC__
68
69 typedef long long natural64;
70 typedef signed long long signed64;
71 typedef unsigned long long unsigned64;
72
73 #define UNSIGNED64(X) (X##ULL)
74 #define SIGNED64(X) (X##LL)
75
76 #define UNSIGNED32(X) (X##UL)
77 #define SIGNED32(X) (X##L)
78
79 #else   /* _WIN32 */
80
81 typedef __int64 natural64;
82 typedef signed __int64 signed64;
83 typedef unsigned __int64 unsigned64;
84
85 #define UNSIGNED64(X) (X##ui64)
86 #define SIGNED64(X) (X##i64)
87
88 #define SIGNED32(X) (X)
89 #define UNSIGNED32(X) (X)
90
91 #endif /* _WIN32 */
92 #else /* Not GNUC or WIN32 */
93 /* Not supported */
94 #endif
95
96 /* byte based */
97 typedef natural8 natural_1;
98 typedef natural16 natural_2;
99 typedef natural32 natural_4;
100 typedef natural64 natural_8;
101
102 typedef signed8 signed_1;
103 typedef signed16 signed_2;
104 typedef signed32 signed_4;
105 typedef signed64 signed_8;
106
107 typedef unsigned8 unsigned_1;
108 typedef unsigned16 unsigned_2;
109 typedef unsigned32 unsigned_4;
110 typedef unsigned64 unsigned_8;
111
112
113 /* for general work, the following are defined */
114 /* unsigned: >= 32 bits */
115 /* signed:   >= 32 bits */
116 /* long:     >= 32 bits, sign undefined */
117 /* int:      small indicator */
118
119 /* target architecture based */
120 #if (WITH_TARGET_WORD_BITSIZE == 64)
121 typedef natural64 natural_word;
122 typedef unsigned64 unsigned_word;
123 typedef signed64 signed_word;
124 #else
125 typedef natural32 natural_word;
126 typedef unsigned32 unsigned_word;
127 typedef signed32 signed_word;
128 #endif
129
130
131 /* Other instructions */
132 typedef unsigned32 address_word;
133
134 /* IEEE 1275 cell size - only support 32bit mode at present */
135 typedef natural32 natural_cell;
136 typedef unsigned32 unsigned_cell;
137 typedef signed32 signed_cell;
138
139 #endif /* _SIM_TYPES_H_ */