2
|
1 |
/*
|
5506
|
2 |
* Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
|
2
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
5506
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
2
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
5506
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
2
|
10 |
*
|
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
* accompanied this code).
|
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU General Public License version
|
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
*
|
5506
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
22 |
* or visit www.oracle.com if you need additional information or have any
|
|
23 |
* questions.
|
2
|
24 |
*/
|
|
25 |
|
|
26 |
|
|
27 |
#ifndef MLIB_TYPES_H
|
|
28 |
#define MLIB_TYPES_H
|
|
29 |
|
|
30 |
#include <limits.h>
|
|
31 |
#if defined(_MSC_VER)
|
|
32 |
#include <float.h> /* for FLT_MAX and DBL_MAX */
|
|
33 |
#endif
|
|
34 |
|
|
35 |
#ifndef DBL_MAX
|
|
36 |
#define DBL_MAX 1.7976931348623157E+308 /* max decimal value of a "double" */
|
|
37 |
#endif
|
|
38 |
|
|
39 |
#ifndef FLT_MAX
|
|
40 |
#define FLT_MAX 3.402823466E+38F /* max decimal value of a "float" */
|
|
41 |
#endif
|
|
42 |
|
|
43 |
#ifndef FLT_MIN
|
|
44 |
#define FLT_MIN 1.175494351e-38F /* min normalised value of a "float" */
|
|
45 |
#endif
|
|
46 |
|
|
47 |
#ifdef __cplusplus
|
|
48 |
extern "C" {
|
|
49 |
#endif
|
|
50 |
|
|
51 |
typedef char mlib_s8;
|
|
52 |
typedef unsigned char mlib_u8;
|
|
53 |
typedef short mlib_s16;
|
|
54 |
typedef unsigned short mlib_u16;
|
|
55 |
typedef int mlib_s32;
|
|
56 |
typedef unsigned int mlib_u32;
|
|
57 |
typedef float mlib_f32;
|
|
58 |
typedef double mlib_d64;
|
|
59 |
|
|
60 |
#if defined(__SUNPRO_C) || defined(__SUNPRO_CC) || defined(__GNUC__)
|
|
61 |
|
|
62 |
#if defined(__linux__)
|
|
63 |
#include <stdint.h> /* for uintptr_t */
|
|
64 |
#include <malloc.h> /* for ptrdiff_t */
|
|
65 |
#else
|
|
66 |
#include <link.h> /* for uintptr_t */
|
|
67 |
#include <stddef.h> /* for ptrdiff_t */
|
|
68 |
#endif /* __linux__ */
|
|
69 |
|
|
70 |
#ifdef MLIB_OS64BIT
|
|
71 |
|
|
72 |
typedef long mlib_s64;
|
|
73 |
typedef unsigned long mlib_u64;
|
|
74 |
|
|
75 |
#define MLIB_S64_MIN LONG_MIN
|
|
76 |
#define MLIB_S64_MAX LONG_MAX
|
|
77 |
|
|
78 |
#define MLIB_S64_CONST(x) x##L
|
|
79 |
#define MLIB_U64_CONST(x) x##UL
|
|
80 |
|
|
81 |
#elif (__STDC__ - 0 == 0) || defined(__GNUC__)
|
|
82 |
|
|
83 |
#if defined(_NO_LONGLONG)
|
|
84 |
|
|
85 |
typedef union {
|
|
86 |
mlib_d64 d64;
|
|
87 |
mlib_s32 s32[2];
|
|
88 |
} mlib_s64;
|
|
89 |
|
|
90 |
typedef union {
|
|
91 |
mlib_d64 d64;
|
|
92 |
mlib_u32 u32[2];
|
|
93 |
} mlib_u64;
|
|
94 |
|
|
95 |
#else
|
|
96 |
|
|
97 |
typedef long long mlib_s64;
|
|
98 |
typedef unsigned long long mlib_u64;
|
|
99 |
|
|
100 |
#define MLIB_S64_MIN LLONG_MIN
|
|
101 |
#define MLIB_S64_MAX LLONG_MAX
|
|
102 |
|
|
103 |
#define MLIB_S64_CONST(x) x##LL
|
|
104 |
#define MLIB_U64_CONST(x) x##ULL
|
|
105 |
|
|
106 |
#endif /* !defined(_NO_LONGLONG) */
|
|
107 |
|
|
108 |
#endif /* MLIB_OS64BIT */
|
|
109 |
|
|
110 |
#elif defined(_MSC_VER)
|
|
111 |
|
|
112 |
#if defined(_NO_LONGLONG)
|
|
113 |
|
|
114 |
typedef union {
|
|
115 |
mlib_d64 d64;
|
|
116 |
mlib_s32 s32[2];
|
|
117 |
} mlib_s64;
|
|
118 |
|
|
119 |
typedef union {
|
|
120 |
mlib_d64 d64;
|
|
121 |
mlib_u32 u32[2];
|
|
122 |
} mlib_u64;
|
|
123 |
|
|
124 |
#else
|
|
125 |
|
|
126 |
typedef __int64 mlib_s64;
|
|
127 |
typedef unsigned __int64 mlib_u64;
|
|
128 |
|
|
129 |
#define MLIB_S64_MIN _I64_MIN
|
|
130 |
#define MLIB_S64_MAX _I64_MAX
|
|
131 |
|
|
132 |
#define MLIB_S64_CONST(x) x##I64
|
|
133 |
#define MLIB_U64_CONST(x) x##UI64
|
|
134 |
|
|
135 |
#endif /* !defined(_NO_LONGLONG) */
|
|
136 |
|
|
137 |
#include <stddef.h>
|
|
138 |
#if !defined(_WIN64)
|
|
139 |
typedef int intptr_t;
|
|
140 |
typedef unsigned int uintptr_t;
|
|
141 |
#endif /* _WIN64 */
|
|
142 |
|
|
143 |
#else
|
|
144 |
|
|
145 |
#error "unknown platform"
|
|
146 |
|
|
147 |
#endif
|
|
148 |
|
|
149 |
typedef uintptr_t mlib_addr;
|
|
150 |
typedef void* mlib_ras;
|
|
151 |
|
|
152 |
#define MLIB_S8_MIN SCHAR_MIN
|
|
153 |
#define MLIB_S8_MAX SCHAR_MAX
|
|
154 |
#define MLIB_U8_MIN 0
|
|
155 |
#define MLIB_U8_MAX UCHAR_MAX
|
|
156 |
#define MLIB_S16_MIN SHRT_MIN
|
|
157 |
#define MLIB_S16_MAX SHRT_MAX
|
|
158 |
#define MLIB_U16_MIN 0
|
|
159 |
#define MLIB_U16_MAX USHRT_MAX
|
|
160 |
#define MLIB_S32_MIN INT_MIN
|
|
161 |
#define MLIB_S32_MAX INT_MAX
|
|
162 |
#define MLIB_U32_MIN 0
|
|
163 |
#define MLIB_U32_MAX UINT_MAX
|
|
164 |
#define MLIB_F32_MIN -FLT_MAX
|
|
165 |
#define MLIB_F32_MAX FLT_MAX
|
|
166 |
#define MLIB_D64_MIN -DBL_MAX
|
|
167 |
#define MLIB_D64_MAX DBL_MAX
|
|
168 |
|
|
169 |
#ifdef __cplusplus
|
|
170 |
}
|
|
171 |
#endif
|
|
172 |
|
|
173 |
#endif /* MLIB_TYPES_H */
|