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