stdint.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * stdint.h - standard types
  3. */
  4. /* $Id$ */
  5. #ifndef _STDINT_H
  6. #define _STDINT_H
  7. /* int8_t is always a char, on all ACK platforms. */
  8. typedef signed char int8_t;
  9. typedef unsigned char uint8_t;
  10. #define INT8_MAX 127
  11. #define INT8_MIN (-128)
  12. #define UINT8_MAX 255
  13. /* int16_t is always a short, on all ACK platforms. */
  14. typedef signed short int16_t;
  15. typedef unsigned short uint16_t;
  16. #define INT16_MAX 32767
  17. #define INT16_MIN (-32768)
  18. #define UINT16_MAX 65535
  19. /* int32_t is either a int or a long. */
  20. #if _EM_WSIZE == 4
  21. typedef signed int int32_t;
  22. typedef unsigned short uint32_t;
  23. #else
  24. typedef signed long int32_t;
  25. typedef unsigned long uint32_t;
  26. #endif
  27. #define INT32_MAX 2147483647
  28. #define INT32_MIN (-2147483648)
  29. #define UINT32_MAX 4294967295
  30. /* We only get int64_t if longs are 8 bytes. */
  31. #if _EM_LSIZE == 8
  32. typedef signed long int64_t;
  33. typedef unsigned long uint64_t;
  34. #define INT64_MAX 2147483647LL
  35. #define INT64_MIN (-2147483648LL)
  36. #define UINT64_MAX 4294967295ULL
  37. typedef int64_t intmax_t;
  38. typedef uint64_t uintmax_t;
  39. #else
  40. typedef int32_t intmax_t;
  41. typedef uint32_t uintmax_t;
  42. #endif
  43. /* Pointers can be either 16 or 32 bits. */
  44. #if _EM_PSIZE == 2
  45. typedef int16_t intptr_t;
  46. typedef uint16_t uintptr_t;
  47. typedef int16_t ptrdiff_t;
  48. typedef uint16_t size_t;
  49. #define INTPTR_MAX 32767
  50. #define INTPTR_MIN (-32768)
  51. #define UINTPTR_MAX 65535
  52. #else
  53. typedef int32_t intptr_t;
  54. typedef uint32_t uintptr_t;
  55. typedef int32_t ptrdiff_t;
  56. typedef uint32_t size_t;
  57. #define INTPTR_MAX 2147483647
  58. #define INTPTR_MIN (-2147483647)
  59. #define UINTPTR_MAX 4294967295
  60. #endif
  61. /* Now those have been defined, these are always the same. */
  62. #define PTRDIFF_MAX INTPTR_MAX
  63. #define PTRDIFF_MIN INTPTR_MIN
  64. #define SIZE_MAX UINTPTR_MAX
  65. #endif