Subversion Repositories eduke32

Rev

Rev 5013 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5013 Rev 5037
Line 67... Line 67...
67
#endif
67
#endif
68
#ifndef max
68
#ifndef max
69
#define max(x,y) ((x) > (y) ? (x) : (y))
69
#define max(x,y) ((x) > (y) ? (x) : (y))
70
#endif
70
#endif
71
71
72
#ifndef __APPLE__
72
#if !defined __APPLE__ && (!defined EDUKE32_BSD || !__STDC__)
73
# include <malloc.h>
73
# include <malloc.h>
74
#endif
74
#endif
75
75
76
#ifdef _WIN32
76
#ifdef _WIN32
77
# define WIN32_LEAN_AND_MEAN
77
# define WIN32_LEAN_AND_MEAN
Line 89... Line 89...
89
#  endif
89
#  endif
90
#  include <CoreServices/CoreServices.h>
90
#  include <CoreServices/CoreServices.h>
91
# endif
91
# endif
92
#endif
92
#endif
93
93
-
 
94
#if defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined __bsdi__ || defined __DragonFly__
-
 
95
# define EDUKE32_BSD
-
 
96
#endif
-
 
97
94
#if defined __ANDROID__ || defined EDUKE32_IOS
98
#if defined __ANDROID__ || defined EDUKE32_IOS
95
# define EDUKE32_TOUCH_DEVICES
99
# define EDUKE32_TOUCH_DEVICES
96
# define EDUKE32_GLES
100
# define EDUKE32_GLES
97
#endif
101
#endif
98
102
Line 262... Line 266...
262
# endif
266
# endif
263
# define B_SWAP64(x) __swap64(x)
267
# define B_SWAP64(x) __swap64(x)
264
# define B_SWAP32(x) __swap32(x)
268
# define B_SWAP32(x) __swap32(x)
265
# define B_SWAP16(x) __swap16(x)
269
# define B_SWAP16(x) __swap16(x)
266
270
267
#elif defined(__FreeBSD__) || defined(__NetBSD__)
271
#elif defined EDUKE32_BSD
268
# include <sys/endian.h>
272
# include <sys/endian.h>
269
# if _BYTE_ORDER == _LITTLE_ENDIAN
273
# if _BYTE_ORDER == _LITTLE_ENDIAN
270
#  define B_LITTLE_ENDIAN 1
274
#  define B_LITTLE_ENDIAN 1
271
#  define B_BIG_ENDIAN    0
275
#  define B_BIG_ENDIAN    0
272
# elif _BYTE_ORDER == _BIG_ENDIAN
276
# elif _BYTE_ORDER == _BIG_ENDIAN
Line 858... Line 862...
858
862
859
FORCE_INLINE void *xaligned_malloc(const bsize_t alignment, const bsize_t size)
863
FORCE_INLINE void *xaligned_malloc(const bsize_t alignment, const bsize_t size)
860
{
864
{
861
#ifdef _WIN32
865
#ifdef _WIN32
862
    void *ptr = _aligned_malloc(size, alignment);
866
    void *ptr = _aligned_malloc(size, alignment);
863
#elif defined __APPLE__
867
#elif defined __APPLE__ || defined EDUKE32_BSD
864
    void *ptr = NULL;
868
    void *ptr = NULL;
865
    posix_memalign(&ptr, alignment, size);
869
    posix_memalign(&ptr, alignment, size);
866
#else
870
#else
867
    void *ptr = memalign(alignment, size);
871
    void *ptr = memalign(alignment, size);
868
#endif
872
#endif