xref: /optee_os/lib/libutils/isoc/include/stdint.h (revision b01047730e77127c23a36591643eeb8bb0487d68)
1*b0104773SPascal Brand /*
2*b0104773SPascal Brand  * Copyright (c) 2014, STMicroelectronics International N.V.
3*b0104773SPascal Brand  * All rights reserved.
4*b0104773SPascal Brand  *
5*b0104773SPascal Brand  * Redistribution and use in source and binary forms, with or without
6*b0104773SPascal Brand  * modification, are permitted provided that the following conditions are met:
7*b0104773SPascal Brand  *
8*b0104773SPascal Brand  * 1. Redistributions of source code must retain the above copyright notice,
9*b0104773SPascal Brand  * this list of conditions and the following disclaimer.
10*b0104773SPascal Brand  *
11*b0104773SPascal Brand  * 2. Redistributions in binary form must reproduce the above copyright notice,
12*b0104773SPascal Brand  * this list of conditions and the following disclaimer in the documentation
13*b0104773SPascal Brand  * and/or other materials provided with the distribution.
14*b0104773SPascal Brand  *
15*b0104773SPascal Brand  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16*b0104773SPascal Brand  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17*b0104773SPascal Brand  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18*b0104773SPascal Brand  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19*b0104773SPascal Brand  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20*b0104773SPascal Brand  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21*b0104773SPascal Brand  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22*b0104773SPascal Brand  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23*b0104773SPascal Brand  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24*b0104773SPascal Brand  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25*b0104773SPascal Brand  * POSSIBILITY OF SUCH DAMAGE.
26*b0104773SPascal Brand  */
27*b0104773SPascal Brand 
28*b0104773SPascal Brand /*
29*b0104773SPascal Brand  * This file provides what C99 standard requires in
30*b0104773SPascal Brand  * 7.18 interger types <stdint.h>
31*b0104773SPascal Brand  * with the exception of:
32*b0104773SPascal Brand  * o Minimum-width integer types
33*b0104773SPascal Brand  * o Fastest minimum-width integer types
34*b0104773SPascal Brand  * o Geatest-width integer types
35*b0104773SPascal Brand  */
36*b0104773SPascal Brand 
37*b0104773SPascal Brand #ifndef STDINT_H
38*b0104773SPascal Brand #define STDINT_H
39*b0104773SPascal Brand #define _STDINT_H
40*b0104773SPascal Brand 
41*b0104773SPascal Brand /* 7.18.1.1 Exact-width interger types */
42*b0104773SPascal Brand #ifndef __int8_t_defined
43*b0104773SPascal Brand # define __int8_t_defined
44*b0104773SPascal Brand typedef signed char             int8_t;
45*b0104773SPascal Brand typedef short int               int16_t;
46*b0104773SPascal Brand typedef int                     int32_t;
47*b0104773SPascal Brand __extension__
48*b0104773SPascal Brand typedef long long int           int64_t;
49*b0104773SPascal Brand #endif
50*b0104773SPascal Brand 
51*b0104773SPascal Brand /* Unsigned.  */
52*b0104773SPascal Brand typedef unsigned char           uint8_t;
53*b0104773SPascal Brand typedef unsigned short int      uint16_t;
54*b0104773SPascal Brand #ifndef __uint32_t_defined
55*b0104773SPascal Brand typedef unsigned int            uint32_t;
56*b0104773SPascal Brand # define __uint32_t_defined
57*b0104773SPascal Brand #endif
58*b0104773SPascal Brand __extension__
59*b0104773SPascal Brand typedef unsigned long long int  uint64_t;
60*b0104773SPascal Brand 
61*b0104773SPascal Brand /* 7.18.1.4 Integer types capable of holding object pointers */
62*b0104773SPascal Brand 
63*b0104773SPascal Brand typedef int32_t intptr_t;
64*b0104773SPascal Brand typedef uint32_t uintptr_t;
65*b0104773SPascal Brand 
66*b0104773SPascal Brand typedef int32_t intmax_t;
67*b0104773SPascal Brand typedef uint32_t uintmax_t;
68*b0104773SPascal Brand 
69*b0104773SPascal Brand /*
70*b0104773SPascal Brand  * 7.18.2 Limits of specified-width integer types
71*b0104773SPascal Brand  */
72*b0104773SPascal Brand 
73*b0104773SPascal Brand /* 7.18.2.1 Limits of exact-width interger types */
74*b0104773SPascal Brand 
75*b0104773SPascal Brand #define INT8_MIN    (-0x7f-1)
76*b0104773SPascal Brand #define INT16_MIN   (-0x7fff-1)
77*b0104773SPascal Brand #define INT32_MIN   (-0x7fffffff-1)
78*b0104773SPascal Brand #define INT64_MIN   (-0x7fffffffffffffffL-1)
79*b0104773SPascal Brand 
80*b0104773SPascal Brand #define INT8_MAX    0x7f
81*b0104773SPascal Brand #define INT16_MAX   0x7fff
82*b0104773SPascal Brand #define INT32_MAX   0x7fffffff
83*b0104773SPascal Brand #define INT64_MAX   0x7fffffffffffffffL
84*b0104773SPascal Brand 
85*b0104773SPascal Brand #define UINT8_MAX    0xff
86*b0104773SPascal Brand #define UINT16_MAX   0xffff
87*b0104773SPascal Brand #define UINT32_MAX   0xffffffffU
88*b0104773SPascal Brand #define UINT64_MAX   0xffffffffffffffffUL
89*b0104773SPascal Brand 
90*b0104773SPascal Brand /* 7.18.2.4 Limits of integer types capable of holding object pointers */
91*b0104773SPascal Brand 
92*b0104773SPascal Brand #define INTPTR_MIN  INT32_MIN
93*b0104773SPascal Brand #define INTPTR_MAX  INT32_MAX
94*b0104773SPascal Brand #define UINTPTR_MAX UINT32_MAX
95*b0104773SPascal Brand 
96*b0104773SPascal Brand #endif /* STDINT_H */
97