1 | /*
|
---|
2 | * Copyright (c) 2011 Petr Koupy
|
---|
3 | * All rights reserved.
|
---|
4 | *
|
---|
5 | * Redistribution and use in source and binary forms, with or without
|
---|
6 | * modification, are permitted provided that the following conditions
|
---|
7 | * are met:
|
---|
8 | *
|
---|
9 | * - Redistributions of source code must retain the above copyright
|
---|
10 | * notice, this list of conditions and the following disclaimer.
|
---|
11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer in the
|
---|
13 | * documentation and/or other materials provided with the distribution.
|
---|
14 | * - The name of the author may not be used to endorse or promote products
|
---|
15 | * derived from this software without specific prior written permission.
|
---|
16 | *
|
---|
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
27 | */
|
---|
28 |
|
---|
29 | /** @addtogroup libposix
|
---|
30 | * @{
|
---|
31 | */
|
---|
32 | /** @file Integer types.
|
---|
33 | */
|
---|
34 |
|
---|
35 | #ifndef POSIX_STDINT_H_
|
---|
36 | #define POSIX_STDINT_H_
|
---|
37 |
|
---|
38 | #include "libc/stdint.h"
|
---|
39 |
|
---|
40 | #undef INT8_MAX
|
---|
41 | #undef INT8_MIN
|
---|
42 | #define INT8_MAX 127
|
---|
43 | #define INT8_MIN (-128)
|
---|
44 |
|
---|
45 | #undef UINT8_MAX
|
---|
46 | #undef UINT8_MIN
|
---|
47 | #define UINT8_MAX 255
|
---|
48 | #define UINT8_MIN 0
|
---|
49 |
|
---|
50 | #undef INT16_MAX
|
---|
51 | #undef INT16_MIN
|
---|
52 | #define INT16_MAX 32767
|
---|
53 | #define INT16_MIN (-32768)
|
---|
54 |
|
---|
55 | #undef UINT16_MAX
|
---|
56 | #undef UINT16_MIN
|
---|
57 | #define UINT16_MAX 65535
|
---|
58 | #define UINT16_MIN 0
|
---|
59 |
|
---|
60 | #undef INT32_MAX
|
---|
61 | #undef INT32_MIN
|
---|
62 | #define INT32_MAX 2147483647
|
---|
63 | #define INT32_MIN (-INT32_MAX - 1)
|
---|
64 |
|
---|
65 | #undef UINT32_MAX
|
---|
66 | #undef UINT32_MIN
|
---|
67 | #define UINT32_MAX 4294967295U
|
---|
68 | #define UINT32_MIN 0U
|
---|
69 |
|
---|
70 | #undef INT64_MAX
|
---|
71 | #undef INT64_MIN
|
---|
72 | #define INT64_MAX 9223372036854775807LL
|
---|
73 | #define INT64_MIN (-INT64_MAX - 1LL)
|
---|
74 |
|
---|
75 | #undef UINT64_MAX
|
---|
76 | #undef UINT64_MIN
|
---|
77 | #define UINT64_MAX 18446744073709551615ULL
|
---|
78 | #define UINT64_MIN 0ULL
|
---|
79 |
|
---|
80 | #undef OFF64_MAX
|
---|
81 | #undef OFF64_MIN
|
---|
82 | #define OFF64_MAX INT64_MAX
|
---|
83 | #define OFF64_MIN INT64_MIN
|
---|
84 |
|
---|
85 | #undef AOFF64_MAX
|
---|
86 | #undef AOFF64_MIN
|
---|
87 | #define AOFF64_MAX UINT64_MAX
|
---|
88 | #define AOFF64_MIN UINT64_MIN
|
---|
89 |
|
---|
90 | #undef INTMAX_MIN
|
---|
91 | #undef INTMAX_MAX
|
---|
92 | #define INTMAX_MIN INT64_MIN
|
---|
93 | #define INTMAX_MAX INT64_MAX
|
---|
94 |
|
---|
95 | #undef UINTMAX_MIN
|
---|
96 | #undef UINTMAX_MAX
|
---|
97 | #define UINTMAX_MIN UINT64_MIN
|
---|
98 | #define UINTMAX_MAX UINT64_MAX
|
---|
99 |
|
---|
100 | #include "libc/sys/types.h"
|
---|
101 |
|
---|
102 | typedef int64_t posix_intmax_t;
|
---|
103 | typedef uint64_t posix_uintmax_t;
|
---|
104 |
|
---|
105 | // FIXME: should be integrated into build process similarly to uintptr_t
|
---|
106 | typedef ssize_t posix_intptr_t;
|
---|
107 |
|
---|
108 | #ifndef LIBPOSIX_INTERNAL
|
---|
109 | #define intmax_t posix_intmax_t
|
---|
110 | #define uintmax_t posix_uintmax_t
|
---|
111 |
|
---|
112 | #define intptr_t posix_intptr_t
|
---|
113 | #endif
|
---|
114 |
|
---|
115 | #endif /* POSIX_STDINT_H_ */
|
---|
116 |
|
---|
117 | /** @}
|
---|
118 | */
|
---|