words.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /* This file is part of psim (model of the PowerPC(tm) architecture)
  2. Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
  3. This library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public License
  5. as published by the Free Software Foundation; either version 3 of
  6. the License, or (at your option) any later version.
  7. This library is distributed in the hope that it will be useful, but
  8. WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public
  12. License along with this library; if not, see <http://www.gnu.org/licenses/>.
  13. --
  14. PowerPC is a trademark of International Business Machines Corporation. */
  15. /* Basic type sizes for the PowerPC */
  16. #ifndef _WORDS_H_
  17. #define _WORDS_H_
  18. /* TYPES:
  19. natural* sign determined by host
  20. signed* signed type of the given size
  21. unsigned* The corresponding insigned type
  22. SIZES
  23. *NN Size based on the number of bits
  24. *_NN Size according to the number of bytes
  25. *_word Size based on the target architecture's word
  26. word size (32/64 bits)
  27. *_cell Size based on the target architecture's
  28. IEEE 1275 cell size (almost always 32 bits)
  29. */
  30. #ifdef HAVE_CONFIG_H
  31. #include "config.h"
  32. #endif
  33. /* bit based */
  34. typedef char natural8;
  35. typedef short natural16;
  36. typedef int natural32;
  37. typedef signed char signed8;
  38. typedef signed short signed16;
  39. typedef signed int signed32;
  40. typedef unsigned char unsigned8;
  41. typedef unsigned short unsigned16;
  42. typedef unsigned int unsigned32;
  43. #ifdef __GNUC__
  44. typedef long long natural64;
  45. typedef signed long long signed64;
  46. typedef unsigned long long unsigned64;
  47. #endif
  48. #ifdef _MSC_VER
  49. typedef __int64 natural64;
  50. typedef signed __int64 signed64;
  51. typedef unsigned __int64 unsigned64;
  52. #endif
  53. /* byte based */
  54. typedef natural8 natural_1;
  55. typedef natural16 natural_2;
  56. typedef natural32 natural_4;
  57. typedef natural64 natural_8;
  58. typedef signed8 signed_1;
  59. typedef signed16 signed_2;
  60. typedef signed32 signed_4;
  61. typedef signed64 signed_8;
  62. typedef unsigned8 unsigned_1;
  63. typedef unsigned16 unsigned_2;
  64. typedef unsigned32 unsigned_4;
  65. typedef unsigned64 unsigned_8;
  66. /* for general work, the following are defined */
  67. /* unsigned: >= 32 bits */
  68. /* signed: >= 32 bits */
  69. /* long: >= 32 bits, sign undefined */
  70. /* int: small indicator */
  71. /* target architecture based */
  72. #if (WITH_TARGET_WORD_BITSIZE == 64)
  73. typedef natural64 natural_word;
  74. typedef unsigned64 unsigned_word;
  75. typedef signed64 signed_word;
  76. #else
  77. typedef natural32 natural_word;
  78. typedef unsigned32 unsigned_word;
  79. typedef signed32 signed_word;
  80. #endif
  81. /* Other instructions */
  82. typedef unsigned32 instruction_word;
  83. /* IEEE 1275 cell size - only support 32bit mode at present */
  84. typedef natural32 natural_cell;
  85. typedef unsigned32 unsigned_cell;
  86. typedef signed32 signed_cell;
  87. #endif /* _WORDS_H_ */