From 21c068f1916330e90f814bed461fe0821d1665ec Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Sun, 9 Oct 2011 16:36:37 +0000 Subject: checked in pd-0.43-0.src.tar.gz svn path=/trunk/; revision=15557 --- pd/src/d_array.c | 56 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 27 deletions(-) (limited to 'pd/src/d_array.c') diff --git a/pd/src/d_array.c b/pd/src/d_array.c index 11a55b5d..c0aab61e 100644 --- a/pd/src/d_array.c +++ b/pd/src/d_array.c @@ -498,50 +498,52 @@ static void tabread4_tilde_setup(void) /* this is all copied from d_osc.c... what include file could this go in? */ #define UNITBIT32 1572864. /* 3*2^19; bit 32 has place value 1 */ - /* machine-dependent definitions. These ifdefs really - should have been by CPU type and not by operating system! */ #ifdef IRIX - /* big-endian. Most significant byte is at low address in memory */ -#define HIOFFSET 0 /* word offset to find MSB */ -#define LOWOFFSET 1 /* word offset to find LSB */ -#define int32 long /* a data type that has 32 bits */ -#endif /* IRIX */ - -#ifdef MSW - /* little-endian; most significant byte is at highest address */ -#define HIOFFSET 1 -#define LOWOFFSET 0 -#define int32 long +#include #endif -#if defined(__FreeBSD__) || defined(__APPLE__) +#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__FreeBSD_kernel__) #include #endif -#ifdef __linux__ +#if defined(__linux__) || defined(__CYGWIN__) || defined(__GNU__) || defined(ANDROID) #include #endif -#if defined(__unix__) || defined(__APPLE__) +#ifdef __MINGW32__ +#include +#endif + +#ifdef _MSC_VER +/* _MSVC lacks BYTE_ORDER and LITTLE_ENDIAN */ +#define LITTLE_ENDIAN 0x0001 +#define BYTE_ORDER LITTLE_ENDIAN +#endif + #if !defined(BYTE_ORDER) || !defined(LITTLE_ENDIAN) #error No byte order defined -#endif +#endif -#if BYTE_ORDER == LITTLE_ENDIAN -#define HIOFFSET 1 -#define LOWOFFSET 0 +#if BYTE_ORDER == LITTLE_ENDIAN +# define HIOFFSET 1 +# define LOWOFFSET 0 #else -#define HIOFFSET 0 /* word offset to find MSB */ -#define LOWOFFSET 1 /* word offset to find LSB */ -#endif /* __BYTE_ORDER */ -#include -#define int32 int32_t -#endif /* __unix__ or __APPLE__*/ +# define HIOFFSET 0 /* word offset to find MSB */ +# define LOWOFFSET 1 /* word offset to find LSB */ +#endif + +#ifdef _MSC_VER + typedef __int32 int32_t; /* use MSVC's internal type */ +#elif defined(IRIX) + typedef long int32_t; /* a data type that has 32 bits */ +#else +# include /* this is where int32_t is defined in C99 */ +#endif union tabfudge { double tf_d; - int32 tf_i[2]; + int32_t tf_i[2]; }; static t_class *tabosc4_tilde_class; -- cgit v1.2.1