added 3dengfx into the repo, probably not the correct version for this
[summerhack] / src / 3dengfx / src / common / types.h
1 /*
2 Copyright (C) 2006 John Tsiombikas <nuclear@siggraph.org>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program 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
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17 */
18
19 /* type.h finds the appropriate way to define sized integer types
20  * and also defines the standard scalar type based on the configuration.
21  */
22 #ifndef FOO_TYPES_H_
23 #define FOO_TYPES_H_
24
25 #include "3dengfx_config.h"
26
27 #ifdef SINGLE_PRECISION_MATH
28 typedef float scalar_t;
29 #else
30 typedef double scalar_t;
31 #endif  /* floating point precision */
32
33 #include <stdlib.h>             /* to get __GLIBC__ defined if applicable */
34
35 #if defined(__MACH__) || defined(__MINGW32__)
36 #define HAVE_STDINT_H
37 #endif  /* explicitly set stdint.h availability for some platform */
38
39 #if (__STDC_VERSION__ >= 199900) || defined(__GLIBC__) || defined(HAVE_STDINT_H)
40 #include <stdint.h>
41 #elif defined(unix) || defined(__unix__)
42 #include <sys/types.h>
43 #elif defined(_MSC_VER)
44 typedef __int8 int8_t;
45 typedef unsigned __int8 uint8_t;
46 typedef __int16 int16_t;
47 typedef unsigned __int16 uint16_t;
48 typedef __int32 int32_t;
49 typedef unsigned __int32 uint32_t;
50 typedef __int64 int64_t;
51 typedef unsigned __int64 uint64_t;
52 #else
53 #error "unsupported platform, or detection failed"
54 #endif  /* stdint detection */
55
56 #endif  /* FOO_TYPES_H_ */