1/* GLIB - Library of useful routines for C programming
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
16 */
17
18/*
19 * Modified by the GLib Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GLib Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GLib at ftp://ftp.gtk.org/pub/gtk/.
23 */
24
25#ifndef __G_TYPES_H__
26#define __G_TYPES_H__
27
28#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
29#error "Only <glib.h> can be included directly."
30#endif
31
32#include <glibconfig.h>
33#include <glib/gmacros.h>
34#include <glib/gversionmacros.h>
35#include <time.h>
36
37G_BEGIN_DECLS
38
39/* Provide type definitions for commonly used types.
40 * These are useful because a "gint8" can be adjusted
41 * to be 1 byte (8 bits) on all platforms. Similarly and
42 * more importantly, "gint32" can be adjusted to be
43 * 4 bytes (32 bits) on all platforms.
44 */
45
46typedef char gchar;
47typedef short gshort;
48typedef long glong;
49typedef int gint;
50typedef gint gboolean;
51
52typedef unsigned char guchar;
53typedef unsigned short gushort;
54typedef unsigned long gulong;
55typedef unsigned int guint;
56
57typedef float gfloat;
58typedef double gdouble;
59
60/* Define min and max constants for the fixed size numerical types */
61/**
62 * G_MININT8: (value -128)
63 *
64 * The minimum value which can be held in a #gint8.
65 *
66 * Since: 2.4
67 */
68#define G_MININT8 ((gint8) (-G_MAXINT8 - 1))
69#define G_MAXINT8 ((gint8) 0x7f)
70#define G_MAXUINT8 ((guint8) 0xff)
71
72/**
73 * G_MININT16: (value -32768)
74 *
75 * The minimum value which can be held in a #gint16.
76 *
77 * Since: 2.4
78 */
79#define G_MININT16 ((gint16) (-G_MAXINT16 - 1))
80#define G_MAXINT16 ((gint16) 0x7fff)
81#define G_MAXUINT16 ((guint16) 0xffff)
82
83/**
84 * G_MININT32: (value -2147483648)
85 *
86 * The minimum value which can be held in a #gint32.
87 *
88 * Since: 2.4
89 */
90#define G_MININT32 ((gint32) (-G_MAXINT32 - 1))
91#define G_MAXINT32 ((gint32) 0x7fffffff)
92#define G_MAXUINT32 ((guint32) 0xffffffff)
93
94/**
95 * G_MININT64: (value -9223372036854775808)
96 *
97 * The minimum value which can be held in a #gint64.
98 */
99#define G_MININT64 ((gint64) (-G_MAXINT64 - G_GINT64_CONSTANT(1)))
100#define G_MAXINT64 G_GINT64_CONSTANT(0x7fffffffffffffff)
101#define G_MAXUINT64 G_GUINT64_CONSTANT(0xffffffffffffffff)
102
103typedef void* gpointer;
104typedef const void *gconstpointer;
105
106typedef gint (*GCompareFunc) (gconstpointer a,
107 gconstpointer b);
108typedef gint (*GCompareDataFunc) (gconstpointer a,
109 gconstpointer b,
110 gpointer user_data);
111typedef gboolean (*GEqualFunc) (gconstpointer a,
112 gconstpointer b);
113typedef void (*GDestroyNotify) (gpointer data);
114typedef void (*GFunc) (gpointer data,
115 gpointer user_data);
116typedef guint (*GHashFunc) (gconstpointer key);
117typedef void (*GHFunc) (gpointer key,
118 gpointer value,
119 gpointer user_data);
120
121/**
122 * GFreeFunc:
123 * @data: a data pointer
124 *
125 * Declares a type of function which takes an arbitrary
126 * data pointer argument and has no return value. It is
127 * not currently used in GLib or GTK+.
128 */
129typedef void (*GFreeFunc) (gpointer data);
130
131/**
132 * GTranslateFunc:
133 * @str: the untranslated string
134 * @data: user data specified when installing the function, e.g.
135 * in g_option_group_set_translate_func()
136 *
137 * The type of functions which are used to translate user-visible
138 * strings, for <option>--help</option> output.
139 *
140 * Returns: a translation of the string for the current locale.
141 * The returned string is owned by GLib and must not be freed.
142 */
143typedef const gchar * (*GTranslateFunc) (const gchar *str,
144 gpointer data);
145
146
147/* Define some mathematical constants that aren't available
148 * symbolically in some strict ISO C implementations.
149 *
150 * Note that the large number of digits used in these definitions
151 * doesn't imply that GLib or current computers in general would be
152 * able to handle floating point numbers with an accuracy like this.
153 * It's mostly an exercise in futility and future proofing. For
154 * extended precision floating point support, look somewhere else
155 * than GLib.
156 */
157#define G_E 2.7182818284590452353602874713526624977572470937000
158#define G_LN2 0.69314718055994530941723212145817656807550013436026
159#define G_LN10 2.3025850929940456840179914546843642076011014886288
160#define G_PI 3.1415926535897932384626433832795028841971693993751
161#define G_PI_2 1.5707963267948966192313216916397514420985846996876
162#define G_PI_4 0.78539816339744830961566084581987572104929234984378
163#define G_SQRT2 1.4142135623730950488016887242096980785696718753769
164
165/* Portable endian checks and conversions
166 *
167 * glibconfig.h defines G_BYTE_ORDER which expands to one of
168 * the below macros.
169 */
170#define G_LITTLE_ENDIAN 1234
171#define G_BIG_ENDIAN 4321
172#define G_PDP_ENDIAN 3412 /* unused, need specific PDP check */
173
174
175/* Basic bit swapping functions
176 */
177#define GUINT16_SWAP_LE_BE_CONSTANT(val) ((guint16) ( \
178 (guint16) ((guint16) (val) >> 8) | \
179 (guint16) ((guint16) (val) << 8)))
180
181#define GUINT32_SWAP_LE_BE_CONSTANT(val) ((guint32) ( \
182 (((guint32) (val) & (guint32) 0x000000ffU) << 24) | \
183 (((guint32) (val) & (guint32) 0x0000ff00U) << 8) | \
184 (((guint32) (val) & (guint32) 0x00ff0000U) >> 8) | \
185 (((guint32) (val) & (guint32) 0xff000000U) >> 24)))
186
187#define GUINT64_SWAP_LE_BE_CONSTANT(val) ((guint64) ( \
188 (((guint64) (val) & \
189 (guint64) G_GINT64_CONSTANT (0x00000000000000ffU)) << 56) | \
190 (((guint64) (val) & \
191 (guint64) G_GINT64_CONSTANT (0x000000000000ff00U)) << 40) | \
192 (((guint64) (val) & \
193 (guint64) G_GINT64_CONSTANT (0x0000000000ff0000U)) << 24) | \
194 (((guint64) (val) & \
195 (guint64) G_GINT64_CONSTANT (0x00000000ff000000U)) << 8) | \
196 (((guint64) (val) & \
197 (guint64) G_GINT64_CONSTANT (0x000000ff00000000U)) >> 8) | \
198 (((guint64) (val) & \
199 (guint64) G_GINT64_CONSTANT (0x0000ff0000000000U)) >> 24) | \
200 (((guint64) (val) & \
201 (guint64) G_GINT64_CONSTANT (0x00ff000000000000U)) >> 40) | \
202 (((guint64) (val) & \
203 (guint64) G_GINT64_CONSTANT (0xff00000000000000U)) >> 56)))
204
205/* Arch specific stuff for speed
206 */
207#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__)
208
209# if __GNUC__ >= 4 && defined (__GNUC_MINOR__) && __GNUC_MINOR__ >= 3
210# define GUINT32_SWAP_LE_BE(val) ((guint32) __builtin_bswap32 ((guint32) (val)))
211# define GUINT64_SWAP_LE_BE(val) ((guint64) __builtin_bswap64 ((guint64) (val)))
212# endif
213
214# if defined (__i386__)
215# define GUINT16_SWAP_LE_BE_IA32(val) \
216 (G_GNUC_EXTENSION \
217 ({ guint16 __v, __x = ((guint16) (val)); \
218 if (__builtin_constant_p (__x)) \
219 __v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \
220 else \
221 __asm__ ("rorw $8, %w0" \
222 : "=r" (__v) \
223 : "0" (__x) \
224 : "cc"); \
225 __v; }))
226# if !defined (__i486__) && !defined (__i586__) \
227 && !defined (__pentium__) && !defined (__i686__) \
228 && !defined (__pentiumpro__) && !defined (__pentium4__)
229# define GUINT32_SWAP_LE_BE_IA32(val) \
230 (G_GNUC_EXTENSION \
231 ({ guint32 __v, __x = ((guint32) (val)); \
232 if (__builtin_constant_p (__x)) \
233 __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \
234 else \
235 __asm__ ("rorw $8, %w0\n\t" \
236 "rorl $16, %0\n\t" \
237 "rorw $8, %w0" \
238 : "=r" (__v) \
239 : "0" (__x) \
240 : "cc"); \
241 __v; }))
242# else /* 486 and higher has bswap */
243# define GUINT32_SWAP_LE_BE_IA32(val) \
244 (G_GNUC_EXTENSION \
245 ({ guint32 __v, __x = ((guint32) (val)); \
246 if (__builtin_constant_p (__x)) \
247 __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \
248 else \
249 __asm__ ("bswap %0" \
250 : "=r" (__v) \
251 : "0" (__x)); \
252 __v; }))
253# endif /* processor specific 32-bit stuff */
254# define GUINT64_SWAP_LE_BE_IA32(val) \
255 (G_GNUC_EXTENSION \
256 ({ union { guint64 __ll; \
257 guint32 __l[2]; } __w, __r; \
258 __w.__ll = ((guint64) (val)); \
259 if (__builtin_constant_p (__w.__ll)) \
260 __r.__ll = GUINT64_SWAP_LE_BE_CONSTANT (__w.__ll); \
261 else \
262 { \
263 __r.__l[0] = GUINT32_SWAP_LE_BE (__w.__l[1]); \
264 __r.__l[1] = GUINT32_SWAP_LE_BE (__w.__l[0]); \
265 } \
266 __r.__ll; }))
267 /* Possibly just use the constant version and let gcc figure it out? */
268# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA32 (val))
269# ifndef GUINT32_SWAP_LE_BE
270# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA32 (val))
271# endif
272# ifndef GUINT64_SWAP_LE_BE
273# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_IA32 (val))
274# endif
275# elif defined (__ia64__)
276# define GUINT16_SWAP_LE_BE_IA64(val) \
277 (G_GNUC_EXTENSION \
278 ({ guint16 __v, __x = ((guint16) (val)); \
279 if (__builtin_constant_p (__x)) \
280 __v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \
281 else \
282 __asm__ __volatile__ ("shl %0 = %1, 48 ;;" \
283 "mux1 %0 = %0, @rev ;;" \
284 : "=r" (__v) \
285 : "r" (__x)); \
286 __v; }))
287# define GUINT32_SWAP_LE_BE_IA64(val) \
288 (G_GNUC_EXTENSION \
289 ({ guint32 __v, __x = ((guint32) (val)); \
290 if (__builtin_constant_p (__x)) \
291 __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \
292 else \
293 __asm__ __volatile__ ("shl %0 = %1, 32 ;;" \
294 "mux1 %0 = %0, @rev ;;" \
295 : "=r" (__v) \
296 : "r" (__x)); \
297 __v; }))
298# define GUINT64_SWAP_LE_BE_IA64(val) \
299 (G_GNUC_EXTENSION \
300 ({ guint64 __v, __x = ((guint64) (val)); \
301 if (__builtin_constant_p (__x)) \
302 __v = GUINT64_SWAP_LE_BE_CONSTANT (__x); \
303 else \
304 __asm__ __volatile__ ("mux1 %0 = %1, @rev ;;" \
305 : "=r" (__v) \
306 : "r" (__x)); \
307 __v; }))
308# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA64 (val))
309# ifndef GUINT32_SWAP_LE_BE
310# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA64 (val))
311# endif
312# ifndef GUINT64_SWAP_LE_BE
313# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_IA64 (val))
314# endif
315# elif defined (__x86_64__)
316# define GUINT32_SWAP_LE_BE_X86_64(val) \
317 (G_GNUC_EXTENSION \
318 ({ guint32 __v, __x = ((guint32) (val)); \
319 if (__builtin_constant_p (__x)) \
320 __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \
321 else \
322 __asm__ ("bswapl %0" \
323 : "=r" (__v) \
324 : "0" (__x)); \
325 __v; }))
326# define GUINT64_SWAP_LE_BE_X86_64(val) \
327 (G_GNUC_EXTENSION \
328 ({ guint64 __v, __x = ((guint64) (val)); \
329 if (__builtin_constant_p (__x)) \
330 __v = GUINT64_SWAP_LE_BE_CONSTANT (__x); \
331 else \
332 __asm__ ("bswapq %0" \
333 : "=r" (__v) \
334 : "0" (__x)); \
335 __v; }))
336 /* gcc seems to figure out optimal code for this on its own */
337# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val))
338# ifndef GUINT32_SWAP_LE_BE
339# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_X86_64 (val))
340# endif
341# ifndef GUINT64_SWAP_LE_BE
342# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_X86_64 (val))
343# endif
344# else /* generic gcc */
345# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val))
346# ifndef GUINT32_SWAP_LE_BE
347# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val))
348# endif
349# ifndef GUINT64_SWAP_LE_BE
350# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT (val))
351# endif
352# endif
353#else /* generic */
354# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val))
355# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val))
356# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT (val))
357#endif /* generic */
358
359#define GUINT16_SWAP_LE_PDP(val) ((guint16) (val))
360#define GUINT16_SWAP_BE_PDP(val) (GUINT16_SWAP_LE_BE (val))
361#define GUINT32_SWAP_LE_PDP(val) ((guint32) ( \
362 (((guint32) (val) & (guint32) 0x0000ffffU) << 16) | \
363 (((guint32) (val) & (guint32) 0xffff0000U) >> 16)))
364#define GUINT32_SWAP_BE_PDP(val) ((guint32) ( \
365 (((guint32) (val) & (guint32) 0x00ff00ffU) << 8) | \
366 (((guint32) (val) & (guint32) 0xff00ff00U) >> 8)))
367
368/* The G*_TO_?E() macros are defined in glibconfig.h.
369 * The transformation is symmetric, so the FROM just maps to the TO.
370 */
371#define GINT16_FROM_LE(val) (GINT16_TO_LE (val))
372#define GUINT16_FROM_LE(val) (GUINT16_TO_LE (val))
373#define GINT16_FROM_BE(val) (GINT16_TO_BE (val))
374#define GUINT16_FROM_BE(val) (GUINT16_TO_BE (val))
375#define GINT32_FROM_LE(val) (GINT32_TO_LE (val))
376#define GUINT32_FROM_LE(val) (GUINT32_TO_LE (val))
377#define GINT32_FROM_BE(val) (GINT32_TO_BE (val))
378#define GUINT32_FROM_BE(val) (GUINT32_TO_BE (val))
379
380#define GINT64_FROM_LE(val) (GINT64_TO_LE (val))
381#define GUINT64_FROM_LE(val) (GUINT64_TO_LE (val))
382#define GINT64_FROM_BE(val) (GINT64_TO_BE (val))
383#define GUINT64_FROM_BE(val) (GUINT64_TO_BE (val))
384
385#define GLONG_FROM_LE(val) (GLONG_TO_LE (val))
386#define GULONG_FROM_LE(val) (GULONG_TO_LE (val))
387#define GLONG_FROM_BE(val) (GLONG_TO_BE (val))
388#define GULONG_FROM_BE(val) (GULONG_TO_BE (val))
389
390#define GINT_FROM_LE(val) (GINT_TO_LE (val))
391#define GUINT_FROM_LE(val) (GUINT_TO_LE (val))
392#define GINT_FROM_BE(val) (GINT_TO_BE (val))
393#define GUINT_FROM_BE(val) (GUINT_TO_BE (val))
394
395#define GSIZE_FROM_LE(val) (GSIZE_TO_LE (val))
396#define GSSIZE_FROM_LE(val) (GSSIZE_TO_LE (val))
397#define GSIZE_FROM_BE(val) (GSIZE_TO_BE (val))
398#define GSSIZE_FROM_BE(val) (GSSIZE_TO_BE (val))
399
400/* Portable versions of host-network order stuff
401 */
402#define g_ntohl(val) (GUINT32_FROM_BE (val))
403#define g_ntohs(val) (GUINT16_FROM_BE (val))
404#define g_htonl(val) (GUINT32_TO_BE (val))
405#define g_htons(val) (GUINT16_TO_BE (val))
406
407/* Overflow-checked unsigned integer arithmetic
408 */
409#ifndef _GLIB_TEST_OVERFLOW_FALLBACK
410/* https://bugzilla.gnome.org/show_bug.cgi?id=769104 */
411#if __GNUC__ >= 5 && !defined(__INTEL_COMPILER)
412#define _GLIB_HAVE_BUILTIN_OVERFLOW_CHECKS
413#elif g_macro__has_builtin(__builtin_uadd_overflow)
414#define _GLIB_HAVE_BUILTIN_OVERFLOW_CHECKS
415#endif
416#endif
417
418#define g_uint_checked_add(dest, a, b) \
419 _GLIB_CHECKED_ADD_U32(dest, a, b)
420#define g_uint_checked_mul(dest, a, b) \
421 _GLIB_CHECKED_MUL_U32(dest, a, b)
422
423#define g_uint64_checked_add(dest, a, b) \
424 _GLIB_CHECKED_ADD_U64(dest, a, b)
425#define g_uint64_checked_mul(dest, a, b) \
426 _GLIB_CHECKED_MUL_U64(dest, a, b)
427
428#if GLIB_SIZEOF_SIZE_T == 8
429#define g_size_checked_add(dest, a, b) \
430 _GLIB_CHECKED_ADD_U64(dest, a, b)
431#define g_size_checked_mul(dest, a, b) \
432 _GLIB_CHECKED_MUL_U64(dest, a, b)
433#else
434#define g_size_checked_add(dest, a, b) \
435 _GLIB_CHECKED_ADD_U32(dest, a, b)
436#define g_size_checked_mul(dest, a, b) \
437 _GLIB_CHECKED_MUL_U32(dest, a, b)
438#endif
439
440/* The names of the following inlines are private. Use the macro
441 * definitions above.
442 */
443#ifdef _GLIB_HAVE_BUILTIN_OVERFLOW_CHECKS
444static inline gboolean _GLIB_CHECKED_ADD_U32 (guint32 *dest, guint32 a, guint32 b) {
445 return !__builtin_uadd_overflow(a, b, dest); }
446static inline gboolean _GLIB_CHECKED_MUL_U32 (guint32 *dest, guint32 a, guint32 b) {
447 return !__builtin_umul_overflow(a, b, dest); }
448static inline gboolean _GLIB_CHECKED_ADD_U64 (guint64 *dest, guint64 a, guint64 b) {
449 G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));
450 return !__builtin_uaddll_overflow(a, b, (unsigned long long *) dest); }
451static inline gboolean _GLIB_CHECKED_MUL_U64 (guint64 *dest, guint64 a, guint64 b) {
452 return !__builtin_umulll_overflow(a, b, (unsigned long long *) dest); }
453#else
454static inline gboolean _GLIB_CHECKED_ADD_U32 (guint32 *dest, guint32 a, guint32 b) {
455 *dest = a + b; return *dest >= a; }
456static inline gboolean _GLIB_CHECKED_MUL_U32 (guint32 *dest, guint32 a, guint32 b) {
457 *dest = a * b; return !a || *dest / a == b; }
458static inline gboolean _GLIB_CHECKED_ADD_U64 (guint64 *dest, guint64 a, guint64 b) {
459 *dest = a + b; return *dest >= a; }
460static inline gboolean _GLIB_CHECKED_MUL_U64 (guint64 *dest, guint64 a, guint64 b) {
461 *dest = a * b; return !a || *dest / a == b; }
462#endif
463
464/* IEEE Standard 754 Single Precision Storage Format (gfloat):
465 *
466 * 31 30 23 22 0
467 * +--------+---------------+---------------+
468 * | s 1bit | e[30:23] 8bit | f[22:0] 23bit |
469 * +--------+---------------+---------------+
470 * B0------------------->B1------->B2-->B3-->
471 *
472 * IEEE Standard 754 Double Precision Storage Format (gdouble):
473 *
474 * 63 62 52 51 32 31 0
475 * +--------+----------------+----------------+ +---------------+
476 * | s 1bit | e[62:52] 11bit | f[51:32] 20bit | | f[31:0] 32bit |
477 * +--------+----------------+----------------+ +---------------+
478 * B0--------------->B1---------->B2--->B3----> B4->B5->B6->B7->
479 */
480/* subtract from biased_exponent to form base2 exponent (normal numbers) */
481typedef union _GDoubleIEEE754 GDoubleIEEE754;
482typedef union _GFloatIEEE754 GFloatIEEE754;
483#define G_IEEE754_FLOAT_BIAS (127)
484#define G_IEEE754_DOUBLE_BIAS (1023)
485/* multiply with base2 exponent to get base10 exponent (normal numbers) */
486#define G_LOG_2_BASE_10 (0.30102999566398119521)
487#if G_BYTE_ORDER == G_LITTLE_ENDIAN
488union _GFloatIEEE754
489{
490 gfloat v_float;
491 struct {
492 guint mantissa : 23;
493 guint biased_exponent : 8;
494 guint sign : 1;
495 } mpn;
496};
497union _GDoubleIEEE754
498{
499 gdouble v_double;
500 struct {
501 guint mantissa_low : 32;
502 guint mantissa_high : 20;
503 guint biased_exponent : 11;
504 guint sign : 1;
505 } mpn;
506};
507#elif G_BYTE_ORDER == G_BIG_ENDIAN
508union _GFloatIEEE754
509{
510 gfloat v_float;
511 struct {
512 guint sign : 1;
513 guint biased_exponent : 8;
514 guint mantissa : 23;
515 } mpn;
516};
517union _GDoubleIEEE754
518{
519 gdouble v_double;
520 struct {
521 guint sign : 1;
522 guint biased_exponent : 11;
523 guint mantissa_high : 20;
524 guint mantissa_low : 32;
525 } mpn;
526};
527#else /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */
528#error unknown ENDIAN type
529#endif /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */
530
531typedef struct _GTimeVal GTimeVal;
532
533struct _GTimeVal
534{
535 glong tv_sec;
536 glong tv_usec;
537};
538
539typedef gint grefcount;
540typedef volatile gint gatomicrefcount;
541
542G_END_DECLS
543
544/* We prefix variable declarations so they can
545 * properly get exported in Windows DLLs.
546 */
547#ifndef GLIB_VAR
548# ifdef G_PLATFORM_WIN32
549# ifdef GLIB_STATIC_COMPILATION
550# define GLIB_VAR extern
551# else /* !GLIB_STATIC_COMPILATION */
552# ifdef GLIB_COMPILATION
553# ifdef DLL_EXPORT
554# define GLIB_VAR __declspec(dllexport)
555# else /* !DLL_EXPORT */
556# define GLIB_VAR extern
557# endif /* !DLL_EXPORT */
558# else /* !GLIB_COMPILATION */
559# define GLIB_VAR extern __declspec(dllimport)
560# endif /* !GLIB_COMPILATION */
561# endif /* !GLIB_STATIC_COMPILATION */
562# else /* !G_PLATFORM_WIN32 */
563# define GLIB_VAR _GLIB_EXTERN
564# endif /* !G_PLATFORM_WIN32 */
565#endif /* GLIB_VAR */
566
567#endif /* __G_TYPES_H__ */
568