avr-stdint.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* Definitions for <stdint.h> types on systems using newlib.
  2. Copyright (C) 2012-2015 Free Software Foundation, Inc.
  3. This file is part of GCC.
  4. GCC is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3, or (at your option)
  7. any later version.
  8. GCC is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GCC; see the file COPYING3. If not see
  14. <http://www.gnu.org/licenses/>. */
  15. /*
  16. The intention of this file is to supply definitions that work with
  17. avr-gcc's -mint8 that sets int to an 8-bit type.
  18. This file is intended to yield the same results as newlib-stdint.h,
  19. but there are some differences to newlib-stdint.h:
  20. - AVR is an 8-bit architecture that cannot access 16-bit values
  21. atomically, this SIG_ATOMIC_TYPE is "char".
  22. - For the same reason, [u]int_fast8_t is defined as 8-bit type.
  23. */
  24. #define SIG_ATOMIC_TYPE "char"
  25. #define INT8_TYPE "signed char"
  26. #define INT16_TYPE (INT_TYPE_SIZE == 16 ? "int" : "long int")
  27. #define INT32_TYPE (INT_TYPE_SIZE == 16 ? "long int" : "long long int")
  28. #define INT64_TYPE (INT_TYPE_SIZE == 16 ? "long long int" : 0)
  29. #define UINT8_TYPE "unsigned char"
  30. #define UINT16_TYPE (INT_TYPE_SIZE == 16 ? "unsigned int" : "long unsigned int")
  31. #define UINT32_TYPE (INT_TYPE_SIZE == 16 ? "long unsigned int" : "long long unsigned int")
  32. #define UINT64_TYPE (INT_TYPE_SIZE == 16 ? "long long unsigned int" : 0)
  33. #define INT_LEAST8_TYPE INT8_TYPE
  34. #define INT_LEAST16_TYPE INT16_TYPE
  35. #define INT_LEAST32_TYPE INT32_TYPE
  36. #define INT_LEAST64_TYPE INT64_TYPE
  37. #define UINT_LEAST8_TYPE UINT8_TYPE
  38. #define UINT_LEAST16_TYPE UINT16_TYPE
  39. #define UINT_LEAST32_TYPE UINT32_TYPE
  40. #define UINT_LEAST64_TYPE UINT64_TYPE
  41. #define INT_FAST8_TYPE INT8_TYPE
  42. #define INT_FAST16_TYPE (INT_TYPE_SIZE == 16 ? "int" : INT16_TYPE)
  43. #define INT_FAST32_TYPE INT32_TYPE
  44. #define INT_FAST64_TYPE INT64_TYPE
  45. #define UINT_FAST8_TYPE UINT8_TYPE
  46. #define UINT_FAST16_TYPE (INT_TYPE_SIZE == 16 ? "unsigned int" : UINT16_TYPE)
  47. #define UINT_FAST32_TYPE UINT32_TYPE
  48. #define UINT_FAST64_TYPE UINT64_TYPE
  49. #define INTPTR_TYPE PTRDIFF_TYPE
  50. #ifndef UINTPTR_TYPE
  51. #define UINTPTR_TYPE SIZE_TYPE
  52. #endif