2
* ***** BEGIN GPL LICENSE BLOCK *****
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation; either version 2
7
* of the License, or (at your option) any later version.
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.
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 Foundation,
16
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19
* All rights reserved.
21
* The Original Code is: all of this file.
23
* Contributor(s): none yet.
25
* ***** END GPL LICENSE BLOCK *****
28
/** \file BLI_sys_types.h
31
* A platform-independent definition of [u]intXX_t
32
* Plus the accompanying header include for htonl/ntohl
34
* This file includes <sys/types.h> to define [u]intXX_t types, where
35
* XX can be 8, 16, 32 or 64. Unfortunately, not all systems have this
37
* - Windows uses __intXX compiler-builtin types. These are signed,
38
* so we have to flip the signs.
39
* For these rogue platforms, we make the typedefs ourselves.
43
#ifndef __BLI_SYS_TYPES_H__
44
#define __BLI_SYS_TYPES_H__
50
/* MSVC 2010 and 2012 (>=1600) have stdint.h so we should use this for consistency */
51
#if defined(_WIN32) && defined(_MSC_VER) && _MSC_VER <= 1500
53
/* The __intXX are built-in types of the visual compiler! So we don't
54
* need to include anything else here. */
57
typedef signed __int8 int8_t;
58
typedef signed __int16 int16_t;
59
typedef signed __int32 int32_t;
60
typedef signed __int64 int64_t;
62
typedef unsigned __int8 uint8_t;
63
typedef unsigned __int16 uint16_t;
64
typedef unsigned __int32 uint32_t;
65
typedef unsigned __int64 uint64_t;
67
#ifndef _INTPTR_T_DEFINED
69
typedef __int64 intptr_t;
71
typedef long intptr_t;
73
#define _INTPTR_T_DEFINED
76
#ifndef _UINTPTR_T_DEFINED
78
typedef unsigned __int64 uintptr_t;
80
typedef unsigned long uintptr_t;
82
#define _UINTPTR_T_DEFINED
85
#elif defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__)
87
/* Linux-i386, Linux-Alpha, Linux-ppc */
92
# define UINT64_MAX 18446744073709551615
93
typedef uint8_t u_int8_t;
94
typedef uint16_t u_int16_t;
95
typedef uint32_t u_int32_t;
96
typedef uint64_t u_int64_t;
99
#elif defined(__APPLE__)
101
#include <inttypes.h>
103
/* MinGW and MSVC >= 2010 */
104
#elif defined(FREE_WINDOWS) || (defined(_MSC_VER) && _MSC_VER >= 1600)
109
/* FreeBSD, Solaris */
110
#include <sys/types.h>
112
#endif /* ifdef platform for types */
115
/* note: use of (int, TRUE / FALSE) is deprecated,
116
* use (bool, true / false) instead */
117
#ifdef HAVE_STDBOOL_H
118
# include <stdbool.h>
122
typedef bool _BLI_Bool;
124
/* Make sure bool is alays defined with the same size for both C and C++ */
125
# define _BLI_Bool unsigned char
128
# define _BLI_Bool _Bool
130
# define bool _BLI_Bool
133
# define __bool_true_false_are_defined 1
136
/* remove this when we're ready to remove TRUE/FALSE completely */
137
#ifdef WITH_BOOL_COMPAT
138
/* interim until all occurrences of these can be updated to stdbool */
139
/* XXX Why not use the true/false velues here? */