4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21 * All rights reserved.
23 * The Original Code is: all of this file.
25 * Contributor(s): none yet.
27 * ***** END GPL LICENSE BLOCK *****
28 * A platform-independent definition of [u]intXX_t
29 * Plus the accompanying header include for htonl/ntohl
31 * This file includes <sys/types.h> to define [u]intXX_t types, where
32 * XX can be 8, 16, 32 or 64. Unfortunately, not all systems have this
34 * - Windows uses __intXX compiler-builtin types. These are signed,
35 * so we have to flip the signs.
36 * For these rogue platforms, we make the typedefs ourselves.
41 // DG: original BLO_sys_types.h is in source/blender/blenkernel
42 // but is not allowed be accessed here because of bad-level-call
43 // jesterKing: I've renamed this to MEM_sys_types.h, because otherwise
44 // doxygen would get a conflict
47 /** \file MEM_sys_types.h
51 #ifndef MEM_SYS_TYPES_H
52 #define MEM_SYS_TYPES_H
58 #if defined(_WIN32) && !defined(FREE_WINDOWS)
60 /* The __intXX are built-in types of the visual complier! So we don't
61 * need to include anything else here. */
63 typedef signed __int8 int8_t;
64 typedef signed __int16 int16_t;
65 typedef signed __int32 int32_t;
66 typedef signed __int64 int64_t;
68 typedef unsigned __int8 uint8_t;
69 typedef unsigned __int16 uint16_t;
70 typedef unsigned __int32 uint32_t;
71 typedef unsigned __int64 uint64_t;
73 #ifndef _INTPTR_T_DEFINED
75 typedef __int64 intptr_t;
77 typedef long intptr_t;
79 #define _INTPTR_T_DEFINED
82 #ifndef _UINTPTR_T_DEFINED
84 typedef unsigned __int64 uintptr_t;
86 typedef unsigned long uintptr_t;
88 #define _UINTPTR_T_DEFINED
91 #elif defined(__linux__) || defined(__NetBSD__)
93 /* Linux-i386, Linux-Alpha, Linux-ppc */
96 #elif defined (__APPLE__)
100 #elif defined(FREE_WINDOWS)
106 /* FreeBSD, Irix, Solaris */
107 #include <sys/types.h>
109 #endif /* ifdef platform for types */
113 #define htonl(x) correctByteOrder(x)
116 #define ntohl(x) correctByteOrder(x)
118 #elif defined (__FreeBSD__) || defined (__OpenBSD__)
119 #include <sys/param.h>
120 #elif defined (__APPLE__)
121 #include <sys/types.h>
122 #else /* irix sun linux */
123 #include <netinet/in.h>
124 #endif /* ifdef platform for htonl/ntohl */
130 #endif /* MEM_SYS_TYPES_H */