stdint.h revision debc021491530ff014166d48232b906d66a62b54
1a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project/*
2a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project * Copyright (C) 2008 The Android Open Source Project
3a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project * All rights reserved.
4a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project *
5a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project * Redistribution and use in source and binary forms, with or without
6a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project * modification, are permitted provided that the following conditions
7a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project * are met:
8a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project *  * Redistributions of source code must retain the above copyright
9a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project *    notice, this list of conditions and the following disclaimer.
10a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project *  * Redistributions in binary form must reproduce the above copyright
11a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project *    notice, this list of conditions and the following disclaimer in
12a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project *    the documentation and/or other materials provided with the
13a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project *    distribution.
14a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project *
15a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project * SUCH DAMAGE.
27a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project */
28a9a02acc9f5d7b13c742172fe1763840eecd8578Elliott Hughes
29a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#ifndef _STDINT_H
30a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#define _STDINT_H
31a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
32a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#include <stddef.h>
33a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#include <sys/_types.h>
34a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
35a9a02acc9f5d7b13c742172fe1763840eecd8578Elliott Hughes#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) || (__cplusplus >= 201103L)
36a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define __STDINT_LIMITS
37a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#endif
38a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
39a9a02acc9f5d7b13c742172fe1763840eecd8578Elliott Hughes#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) || (__cplusplus >= 201103L)
40a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define  __STDINT_MACROS
41a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#endif
42a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
43a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef __int8_t      int8_t;
44a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef __uint8_t     uint8_t;
45a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef __int16_t     int16_t;
46a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef __uint16_t    uint16_t;
47a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef __int32_t     int32_t;
48a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef __uint32_t    uint32_t;
49a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef __int64_t     int64_t;
50a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef __uint64_t    uint64_t;
51a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
52a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project/*
53a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project * int8_t & uint8_t
54a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project */
55a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
56a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef int8_t        int_least8_t;
57a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef int8_t        int_fast8_t;
58a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
59a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef uint8_t       uint_least8_t;
60a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef uint8_t       uint_fast8_t;
61a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
62a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#ifdef __STDINT_LIMITS
63a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT8_MIN         (-128)
64a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT8_MAX         (127)
65a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_LEAST8_MIN   INT8_MIN
66a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_LEAST8_MAX   INT8_MAX
67a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_FAST8_MIN    INT8_MIN
68a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_FAST8_MAX    INT8_MAX
69a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
70dc5d3426d8c50c29c3a92ff9c9ca61d069e8dfebSergey Melnikov#  define UINT8_MAX           (255)
71a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define UINT_LEAST8_MAX     UINT8_MAX
72a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define UINT_FAST8_MAX      UINT8_MAX
73a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#endif
74a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
75a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#ifdef __STDINT_MACROS
76a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT8_C(c)	c
77a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_LEAST8_C(c)	 INT8_C(c)
78a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_FAST8_C(c)	INT8_C(c)
79a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
80dc5d3426d8c50c29c3a92ff9c9ca61d069e8dfebSergey Melnikov#  define UINT8_C(c)	c
81a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define UINT_LEAST8_C(c)  UINT8_C(c)
82a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define UINT_FAST8_C(c)  UINT8_C(c)
83a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#endif
84a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
85a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project/*
86a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project * int16_t & uint16_t
87a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project */
88a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
89a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef int16_t       int_least16_t;
90a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef int32_t       int_fast16_t;
91a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
92a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef uint16_t      uint_least16_t;
93a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef uint32_t      uint_fast16_t;
94a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
95a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#ifdef __STDINT_LIMITS
96a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT16_MIN	(-32768)
97a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT16_MAX	(32767)
98a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_LEAST16_MIN	INT16_MIN
99a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_LEAST16_MAX	INT16_MAX
100a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_FAST16_MIN	INT32_MIN
101a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_FAST16_MAX	INT32_MAX
102a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
103dc5d3426d8c50c29c3a92ff9c9ca61d069e8dfebSergey Melnikov#  define UINT16_MAX	(65535)
104a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define UINT_LEAST16_MAX UINT16_MAX
105a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define UINT_FAST16_MAX UINT32_MAX
106a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#endif
107a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
108a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#ifdef __STDINT_MACROS
109a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT16_C(c)	c
110a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_LEAST16_C(c) INT16_C(c)
111a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_FAST16_C(c)	 INT32_C(c)
112a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
113dc5d3426d8c50c29c3a92ff9c9ca61d069e8dfebSergey Melnikov#  define UINT16_C(c)	c
114a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define UINT_LEAST16_C(c) UINT16_C(c)
115a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define UINT_FAST16_C(c) UINT32_C(c)
116a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#endif
117a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
118a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project/*
119a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project * int32_t & uint32_t
120a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project */
121a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
122a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef int32_t       int_least32_t;
123a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef int32_t       int_fast32_t;
124a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
125a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef uint32_t      uint_least32_t;
126a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef uint32_t      uint_fast32_t;
127a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
128a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#ifdef __STDINT_LIMITS
129a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT32_MIN	(-2147483647-1)
130a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT32_MAX	(2147483647)
131a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_LEAST32_MIN	INT32_MIN
132a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_LEAST32_MAX	INT32_MAX
133a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_FAST32_MIN	INT32_MIN
134a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_FAST32_MAX	INT32_MAX
135a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
136a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define UINT32_MAX	(4294967295U)
137a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define UINT_LEAST32_MAX UINT32_MAX
138a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define UINT_FAST32_MAX UINT32_MAX
139a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#endif
140a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
141a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#ifdef __STDINT_MACROS
142a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT32_C(c)	c
143a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_LEAST32_C(c) INT32_C(c)
144a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_FAST32_C(c)  INT32_C(c)
145a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
146a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define UINT32_C(c)	c ## U
147a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define UINT_LEAST32_C(c) UINT32_C(c)
148a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define UINT_FAST32_C(c) UINT32_C(c)
149a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#endif
150a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
151a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project/*
152a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project *  int64_t
153a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project */
1546d6731adc0cd0fb249a2b73a575e5ab2204643ccElliott Hughes
155a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef int64_t       int_least64_t;
156a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef int64_t       int_fast64_t;
157a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
158a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef uint64_t      uint_least64_t;
159a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef uint64_t      uint_fast64_t;
160a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
161a9a02acc9f5d7b13c742172fe1763840eecd8578Elliott Hughes#if __LP64__
162a9a02acc9f5d7b13c742172fe1763840eecd8578Elliott Hughes#  define __INT64_C(c)  c ## L
163a9a02acc9f5d7b13c742172fe1763840eecd8578Elliott Hughes#  define __UINT64_C(c) c ## UL
164a9a02acc9f5d7b13c742172fe1763840eecd8578Elliott Hughes#else
165a9a02acc9f5d7b13c742172fe1763840eecd8578Elliott Hughes#  define __INT64_C(c)  c ## LL
166a9a02acc9f5d7b13c742172fe1763840eecd8578Elliott Hughes#  define __UINT64_C(c) c ## ULL
167a9a02acc9f5d7b13c742172fe1763840eecd8578Elliott Hughes#endif
168a9a02acc9f5d7b13c742172fe1763840eecd8578Elliott Hughes
169a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#ifdef __STDINT_LIMITS
170a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT64_MIN        (__INT64_C(-9223372036854775807)-1)
171a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT64_MAX        (__INT64_C(9223372036854775807))
172a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_LEAST64_MIN  INT64_MIN
173a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_LEAST64_MAX  INT64_MAX
174a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_FAST64_MIN   INT64_MIN
175a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_FAST64_MAX   INT64_MAX
176a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define UINT64_MAX       (__UINT64_C(18446744073709551615))
177a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
178a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define UINT_LEAST64_MAX UINT64_MAX
179a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define UINT_FAST64_MAX UINT64_MAX
180a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#endif
181a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
182a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#ifdef __STDINT_MACROS
183a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT64_C(c)       __INT64_C(c)
184a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_LEAST64_C(c) INT64_C(c)
185a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INT_FAST64_C(c)  INT64_C(c)
186a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
187a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define UINT64_C(c)       __UINT64_C(c)
188a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define UINT_LEAST64_C(c) UINT64_C(c)
189a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define UINT_FAST64_C(c)  UINT64_C(c)
190a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#endif
191a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
192a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define __PRI64_RANK   "ll"
193a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define __PRIFAST_RANK ""
194a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define __PRIPTR_RANK  ""
195a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
196debc021491530ff014166d48232b906d66a62b54Serban Constantinescu
197a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project/*
198a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project * intptr_t & uintptr_t
199a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project */
200a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
2010a9c615a899daa37b671711acc2c9be0a245919fPavel Chupin#ifdef __LP64__
202debc021491530ff014166d48232b906d66a62b54Serban Constantinescu
2030a9c615a899daa37b671711acc2c9be0a245919fPavel Chupintypedef long           intptr_t;
2040a9c615a899daa37b671711acc2c9be0a245919fPavel Chupintypedef unsigned long  uintptr_t;
205debc021491530ff014166d48232b906d66a62b54Serban Constantinescu
206debc021491530ff014166d48232b906d66a62b54Serban Constantinescu#ifdef __STDINT_LIMITS
207debc021491530ff014166d48232b906d66a62b54Serban Constantinescu#  define INTPTR_MIN    INT64_MIN
208debc021491530ff014166d48232b906d66a62b54Serban Constantinescu#  define INTPTR_MAX    INT64_MAX
209debc021491530ff014166d48232b906d66a62b54Serban Constantinescu#  define UINTPTR_MAX   UINT64_MAX
210debc021491530ff014166d48232b906d66a62b54Serban Constantinescu#  define PTRDIFF_MIN   INT64_MIN
211debc021491530ff014166d48232b906d66a62b54Serban Constantinescu#  define PTRDIFF_MAX   INT64_MAX
212debc021491530ff014166d48232b906d66a62b54Serban Constantinescu#endif
213debc021491530ff014166d48232b906d66a62b54Serban Constantinescu#ifdef __STDINT_MACROS
214debc021491530ff014166d48232b906d66a62b54Serban Constantinescu#  define INTPTR_C(c)   INT64_C(c)
215debc021491530ff014166d48232b906d66a62b54Serban Constantinescu#  define UINTPTR_C(c)  UINT64_C(c)
216debc021491530ff014166d48232b906d66a62b54Serban Constantinescu#  define PTRDIFF_C(c)  INT64_C(c)
217debc021491530ff014166d48232b906d66a62b54Serban Constantinescu#endif
218debc021491530ff014166d48232b906d66a62b54Serban Constantinescu
2190a9c615a899daa37b671711acc2c9be0a245919fPavel Chupin#else
220debc021491530ff014166d48232b906d66a62b54Serban Constantinescu
221a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef int           intptr_t;
222a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef unsigned int  uintptr_t;
223a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
22408ff1a647484e67f23d1d8a0364b2e930dd2b9daDavid 'Digit' Turner#ifdef __STDINT_LIMITS
225a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INTPTR_MIN    INT32_MIN
226a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INTPTR_MAX    INT32_MAX
227a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define UINTPTR_MAX   UINT32_MAX
22808ff1a647484e67f23d1d8a0364b2e930dd2b9daDavid 'Digit' Turner#  define PTRDIFF_MIN   INT32_MIN
22908ff1a647484e67f23d1d8a0364b2e930dd2b9daDavid 'Digit' Turner#  define PTRDIFF_MAX   INT32_MAX
23008ff1a647484e67f23d1d8a0364b2e930dd2b9daDavid 'Digit' Turner#endif
23108ff1a647484e67f23d1d8a0364b2e930dd2b9daDavid 'Digit' Turner#ifdef __STDINT_MACROS
232a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define INTPTR_C(c)   INT32_C(c)
233a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define UINTPTR_C(c)  UINT32_C(c)
234a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#  define PTRDIFF_C(c)  INT32_C(c)
23508ff1a647484e67f23d1d8a0364b2e930dd2b9daDavid 'Digit' Turner#endif
23608ff1a647484e67f23d1d8a0364b2e930dd2b9daDavid 'Digit' Turner
237debc021491530ff014166d48232b906d66a62b54Serban Constantinescu#endif /* __LP64__ */
238debc021491530ff014166d48232b906d66a62b54Serban Constantinescu
239debc021491530ff014166d48232b906d66a62b54Serban Constantinescu
240a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project/*
241a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project *  intmax_t & uintmax_t
242a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project */
243a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
244a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef uint64_t uintmax_t;
245a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Projecttypedef int64_t  intmax_t;
246a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
24708ff1a647484e67f23d1d8a0364b2e930dd2b9daDavid 'Digit' Turner#ifdef __STDINT_LIMITS
24808ff1a647484e67f23d1d8a0364b2e930dd2b9daDavid 'Digit' Turner#  define INTMAX_MIN	INT64_MIN
24908ff1a647484e67f23d1d8a0364b2e930dd2b9daDavid 'Digit' Turner#  define INTMAX_MAX	INT64_MAX
25008ff1a647484e67f23d1d8a0364b2e930dd2b9daDavid 'Digit' Turner#  define UINTMAX_MAX	UINT64_MAX
25108ff1a647484e67f23d1d8a0364b2e930dd2b9daDavid 'Digit' Turner#endif
252a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
2530e5411b4ba15946bde04c7ee69b0c20129443b36David 'Digit' Turner#ifdef __STDINT_MACROS
25408ff1a647484e67f23d1d8a0364b2e930dd2b9daDavid 'Digit' Turner#  define INTMAX_C(c)	INT64_C(c)
25508ff1a647484e67f23d1d8a0364b2e930dd2b9daDavid 'Digit' Turner#  define UINTMAX_C(c)	UINT64_C(c)
25608ff1a647484e67f23d1d8a0364b2e930dd2b9daDavid 'Digit' Turner#endif
257a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
2587c89506e3af3ee97691a98329f0d7b5edef49218Elliott Hughes/*
2597c89506e3af3ee97691a98329f0d7b5edef49218Elliott Hughes * sig_atomic_t, size_t, wchar_t, and wint_t.
2607c89506e3af3ee97691a98329f0d7b5edef49218Elliott Hughes */
2617c89506e3af3ee97691a98329f0d7b5edef49218Elliott Hughes
2627c89506e3af3ee97691a98329f0d7b5edef49218Elliott Hughes#ifdef __STDINT_LIMITS
2637c89506e3af3ee97691a98329f0d7b5edef49218Elliott Hughes#  define SIG_ATOMIC_MAX INT32_MAX
2647c89506e3af3ee97691a98329f0d7b5edef49218Elliott Hughes#  define SIG_ATOMIC_MIN INT32_MIN
2657c89506e3af3ee97691a98329f0d7b5edef49218Elliott Hughes
2667c89506e3af3ee97691a98329f0d7b5edef49218Elliott Hughes#  define SIZE_MAX UINT32_MAX
2677c89506e3af3ee97691a98329f0d7b5edef49218Elliott Hughes
2687c89506e3af3ee97691a98329f0d7b5edef49218Elliott Hughes#  ifndef WCHAR_MAX /* These might also have been defined by <wchar.h>. */
2697c89506e3af3ee97691a98329f0d7b5edef49218Elliott Hughes#    define WCHAR_MAX INT32_MAX
2707c89506e3af3ee97691a98329f0d7b5edef49218Elliott Hughes#    define WCHAR_MIN INT32_MIN
2717c89506e3af3ee97691a98329f0d7b5edef49218Elliott Hughes#  endif
2727c89506e3af3ee97691a98329f0d7b5edef49218Elliott Hughes
2737c89506e3af3ee97691a98329f0d7b5edef49218Elliott Hughes#  define WINT_MAX INT32_MAX
2747c89506e3af3ee97691a98329f0d7b5edef49218Elliott Hughes#  define WINT_MIN INT32_MIN
2757c89506e3af3ee97691a98329f0d7b5edef49218Elliott Hughes#endif
2767c89506e3af3ee97691a98329f0d7b5edef49218Elliott Hughes
277a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project/* Keep the kernel from trying to define these types... */
278a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#define __BIT_TYPES_DEFINED__
279a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project
280a27d2baa0c1a2ec70f47ea9199b1dd6762c8a34The Android Open Source Project#endif /* _STDINT_H */
281