2 * Copyright (C) 1999 WIDE Project.
\r
3 * All rights reserved.
\r
5 * Redistribution and use in source and binary forms, with or without
\r
6 * modification, are permitted provided that the following conditions
\r
8 * 1. Redistributions of source code must retain the above copyright
\r
9 * notice, this list of conditions and the following disclaimer.
\r
10 * 2. Redistributions in binary form must reproduce the above copyright
\r
11 * notice, this list of conditions and the following disclaimer in the
\r
12 * documentation and/or other materials provided with the distribution.
\r
13 * 3. Neither the name of the project nor the names of its contributors
\r
14 * may be used to endorse or promote products derived from this software
\r
15 * without specific prior written permission.
\r
17 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
\r
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
\r
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
\r
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
\r
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
\r
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
\r
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
\r
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
\r
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
\r
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
\r
32 #ifndef HAVE_U_INT8_T
\r
34 #if SIZEOF_CHAR == 1
\r
35 typedef unsigned char u_int8_t;
\r
36 typedef signed char _int8_t;
\r
37 #elif SIZEOF_INT == 1
\r
38 typedef unsigned int u_int8_t;
\r
39 typedef signed int int8_t;
\r
41 #error "there's no appropriate type for u_int8_t"
\r
43 #define HAVE_U_INT8_T 1
\r
44 #define HAVE_INT8_T 1
\r
46 #endif /* HAVE_U_INT8_T */
\r
48 #ifndef HAVE_U_INT16_T
\r
50 #if SIZEOF_SHORT == 2
\r
51 typedef unsigned short u_int16_t;
\r
52 typedef signed short _int16_t;
\r
53 #elif SIZEOF_INT == 2
\r
54 typedef unsigned int u_int16_t;
\r
55 typedef signed int int16_t;
\r
56 #elif SIZEOF_CHAR == 2
\r
57 typedef unsigned char u_int16_t;
\r
58 typedef signed char int16_t;
\r
60 #error "there's no appropriate type for u_int16_t"
\r
62 #define HAVE_U_INT16_T 1
\r
63 #define HAVE_INT16_T 1
\r
65 #endif /* HAVE_U_INT16_T */
\r
67 #ifndef HAVE_U_INT32_T
\r
70 typedef unsigned int u_int32_t;
\r
71 typedef signed int _int32_t;
\r
72 #elif SIZEOF_LONG == 4
\r
73 typedef unsigned long u_int32_t;
\r
74 typedef signed long int32_t;
\r
75 #elif SIZEOF_SHORT == 4
\r
76 typedef unsigned short u_int32_t;
\r
77 typedef signed short int32_t;
\r
79 #error "there's no appropriate type for u_int32_t"
\r
81 #define HAVE_U_INT32_T 1
\r
82 #define HAVE_INT32_T 1
\r
84 #endif /* HAVE_U_INT32_T */
\r
86 #ifndef HAVE_U_INT64_T
\r
87 #if SIZEOF_LONG_LONG == 8
\r
88 typedef unsigned long long u_int64_t;
\r
89 typedef long long int64_t;
\r
90 #elif defined(_MSC_EXTENSIONS)
\r
91 typedef unsigned _int64 u_int64_t;
\r
92 typedef _int64 int64_t;
\r
93 #elif SIZEOF_INT == 8
\r
94 typedef unsigned int u_int64_t;
\r
95 #elif SIZEOF_LONG == 8
\r
96 typedef unsigned long u_int64_t;
\r
97 #elif SIZEOF_SHORT == 8
\r
98 typedef unsigned short u_int64_t;
\r
100 #error "there's no appropriate type for u_int64_t"
\r
103 #endif /* HAVE_U_INT64_T */
\r
106 #ifdef _MSC_EXTENSIONS
\r
107 #define PRId64 "I64d"
\r
108 #else /* _MSC_EXTENSIONS */
\r
109 #define PRId64 "lld"
\r
110 #endif /* _MSC_EXTENSIONS */
\r
111 #endif /* PRId64 */
\r
114 #ifdef _MSC_EXTENSIONS
\r
115 #define PRIo64 "I64o"
\r
116 #else /* _MSC_EXTENSIONS */
\r
117 #define PRIo64 "llo"
\r
118 #endif /* _MSC_EXTENSIONS */
\r
119 #endif /* PRIo64 */
\r
122 #ifdef _MSC_EXTENSIONS
\r
123 #define PRIx64 "I64x"
\r
124 #else /* _MSC_EXTENSIONS */
\r
125 #define PRIx64 "llx"
\r
126 #endif /* _MSC_EXTENSIONS */
\r
127 #endif /* PRIx64 */
\r
130 #ifdef _MSC_EXTENSIONS
\r
131 #define PRIu64 "I64u"
\r
132 #else /* _MSC_EXTENSIONS */
\r
133 #define PRIu64 "llu"
\r
134 #endif /* _MSC_EXTENSIONS */
\r
135 #endif /* PRIu64 */
\r
137 #endif /* _BITTYPES_H */
\r