| 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 | |
| 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 3 of |
| 8 | the License, or (at your option) any later version. |
| 9 | |
| 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. |
| 14 | |
| 15 | You should have received a copy of the GNU Library General Public |
| 16 | License along with this library; if not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | -- |
| 19 | |
| 20 | PowerPC is a trademark of International Business Machines Corporation. */ |
| 21 | |
| 22 | |
| 23 | /* Basic type sizes for the PowerPC */ |
| 24 | |
| 25 | #ifndef _WORDS_H_ |
| 26 | #define _WORDS_H_ |
| 27 | |
| 28 | /* TYPES: |
| 29 | |
| 30 | natural* sign determined by host |
| 31 | signed* signed type of the given size |
| 32 | unsigned* The corresponding insigned type |
| 33 | |
| 34 | SIZES |
| 35 | |
| 36 | *NN Size based on the number of bits |
| 37 | *_NN Size according to the number of bytes |
| 38 | *_word Size based on the target architecture's word |
| 39 | word size (32/64 bits) |
| 40 | *_cell Size based on the target architecture's |
| 41 | IEEE 1275 cell size (almost always 32 bits) |
| 42 | |
| 43 | */ |
| 44 | |
| 45 | |
| 46 | #ifdef HAVE_CONFIG_H |
| 47 | #include "config.h" |
| 48 | #endif |
| 49 | |
| 50 | /* bit based */ |
| 51 | typedef char natural8; |
| 52 | typedef short natural16; |
| 53 | typedef int natural32; |
| 54 | |
| 55 | typedef signed char signed8; |
| 56 | typedef signed short signed16; |
| 57 | typedef signed int signed32; |
| 58 | |
| 59 | typedef unsigned char unsigned8; |
| 60 | typedef unsigned short unsigned16; |
| 61 | typedef unsigned int unsigned32; |
| 62 | |
| 63 | #ifdef __GNUC__ |
| 64 | typedef long long natural64; |
| 65 | typedef signed long long signed64; |
| 66 | typedef unsigned long long unsigned64; |
| 67 | #endif |
| 68 | |
| 69 | #ifdef _MSC_VER |
| 70 | typedef __int64 natural64; |
| 71 | typedef signed __int64 signed64; |
| 72 | typedef unsigned __int64 unsigned64; |
| 73 | #endif |
| 74 | |
| 75 | |
| 76 | /* byte based */ |
| 77 | typedef natural8 natural_1; |
| 78 | typedef natural16 natural_2; |
| 79 | typedef natural32 natural_4; |
| 80 | typedef natural64 natural_8; |
| 81 | |
| 82 | typedef signed8 signed_1; |
| 83 | typedef signed16 signed_2; |
| 84 | typedef signed32 signed_4; |
| 85 | typedef signed64 signed_8; |
| 86 | |
| 87 | typedef unsigned8 unsigned_1; |
| 88 | typedef unsigned16 unsigned_2; |
| 89 | typedef unsigned32 unsigned_4; |
| 90 | typedef unsigned64 unsigned_8; |
| 91 | |
| 92 | |
| 93 | /* for general work, the following are defined */ |
| 94 | /* unsigned: >= 32 bits */ |
| 95 | /* signed: >= 32 bits */ |
| 96 | /* long: >= 32 bits, sign undefined */ |
| 97 | /* int: small indicator */ |
| 98 | |
| 99 | /* target architecture based */ |
| 100 | #if (WITH_TARGET_WORD_BITSIZE == 64) |
| 101 | typedef natural64 natural_word; |
| 102 | typedef unsigned64 unsigned_word; |
| 103 | typedef signed64 signed_word; |
| 104 | #else |
| 105 | typedef natural32 natural_word; |
| 106 | typedef unsigned32 unsigned_word; |
| 107 | typedef signed32 signed_word; |
| 108 | #endif |
| 109 | |
| 110 | |
| 111 | /* Other instructions */ |
| 112 | typedef unsigned32 instruction_word; |
| 113 | |
| 114 | /* IEEE 1275 cell size - only support 32bit mode at present */ |
| 115 | typedef natural32 natural_cell; |
| 116 | typedef unsigned32 unsigned_cell; |
| 117 | typedef signed32 signed_cell; |
| 118 | |
| 119 | #endif /* _WORDS_H_ */ |