1 |
/* |
2 |
* PearPC |
3 |
* types.h |
4 |
* |
5 |
* Copyright (C) 1999-2003 Sebastian Biallas (sb@biallas.net) |
6 |
* Copyright (C) 1999-2004 Stefan Weyergraf |
7 |
* |
8 |
* This program is free software; you can redistribute it and/or modify |
9 |
* it under the terms of the GNU General Public License version 2 as |
10 |
* published by the Free Software Foundation. |
11 |
* |
12 |
* This program is distributed in the hope that it will be useful, |
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
* GNU General Public License for more details. |
16 |
* |
17 |
* You should have received a copy of the GNU General Public License |
18 |
* along with this program; if not, write to the Free Software |
19 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 |
*/ |
21 |
|
22 |
#ifndef __TYPES_H__ |
23 |
#define __TYPES_H__ |
24 |
|
25 |
#ifdef HAVE_CONFIG_H |
26 |
#include "config.h" |
27 |
#endif |
28 |
|
29 |
#ifdef MIN |
30 |
#undef MIN |
31 |
#endif |
32 |
#ifdef MAX |
33 |
#undef MAX |
34 |
#endif |
35 |
#define MIN(a, b) ((a) < (b) ? (a) : (b)) |
36 |
#define MAX(a, b) ((a) > (b) ? (a) : (b)) |
37 |
|
38 |
/* |
39 |
* compiler magic |
40 |
*/ |
41 |
|
42 |
#ifdef __GNUC__ |
43 |
|
44 |
// FIXME: configure |
45 |
# ifndef __ppc__ |
46 |
# define FASTCALL __attribute__((regparm (3))) |
47 |
# else |
48 |
# define FASTCALL |
49 |
# endif |
50 |
|
51 |
# define FUNCTION_CONST __attribute__((const)) |
52 |
# define PACKED __attribute__((packed)) |
53 |
# define UNUSED __attribute__((unused)) |
54 |
# define DEPRECATED __attribute__((deprecated)) |
55 |
# define NORETURN __attribute__((noreturn)) |
56 |
# define ALIGN_STRUCT(n) __attribute__((aligned(n))) |
57 |
#else |
58 |
# error "you're not using the GNU C compiler :-( please add the macros and conditionals for your compiler" |
59 |
#endif /* !__GNUC__ */ |
60 |
|
61 |
/* |
62 |
* integers |
63 |
*/ |
64 |
|
65 |
#include SYSTEM_OSAPI_SPECIFIC_TYPES_HDR |
66 |
|
67 |
/* |
68 |
* NULL |
69 |
*/ |
70 |
|
71 |
#ifndef NULL |
72 |
# define NULL 0 |
73 |
#endif |
74 |
|
75 |
//FIXME: configure somehow (?) |
76 |
#ifndef UINT128 |
77 |
# define UINT128 |
78 |
typedef struct uint128 { |
79 |
uint64 l; |
80 |
uint64 h; |
81 |
} uint128; |
82 |
typedef struct sint128 { |
83 |
sint64 l; |
84 |
sint64 h; |
85 |
} sint128; |
86 |
#endif |
87 |
|
88 |
union float_uint32 { |
89 |
uint32 u; |
90 |
float f; |
91 |
}; |
92 |
|
93 |
union double_uint64 { |
94 |
uint64 u; |
95 |
double d; |
96 |
}; |
97 |
|
98 |
#endif |