From: <sch...@us...> - 2012-04-24 07:23:22
|
Revision: 10319 http://octave.svn.sourceforge.net/octave/?rev=10319&view=rev Author: schloegl Date: 2012-04-24 07:23:15 +0000 (Tue, 24 Apr 2012) Log Message: ----------- fix for MinGW and Apple, and eventually Hurd Modified Paths: -------------- trunk/octave-forge/extra/NaN/src/xptopen.cpp Modified: trunk/octave-forge/extra/NaN/src/xptopen.cpp =================================================================== --- trunk/octave-forge/extra/NaN/src/xptopen.cpp 2012-04-24 06:58:30 UTC (rev 10318) +++ trunk/octave-forge/extra/NaN/src/xptopen.cpp 2012-04-24 07:23:15 UTC (rev 10319) @@ -72,15 +72,19 @@ #define max(a,b) (((a) > (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b)) -#if defined(__MINGW32__) +#if 0 + +#elif defined(__linux__) +# include <byteswap.h> + +#elif defined(__GLIBC__) // for Hurd +# include <byteswap.h> + +#elif defined(__MINGW32__) /* use local version because MINGW does not provide byteswap.h */ -# define __BIG_ENDIAN 4321 -# define __LITTLE_ENDIAN 1234 -# define __BYTE_ORDER __LITTLE_ENDIAN -# include "win32/byteswap.h" -# define bswap_16(x) __bswap_16(x) -# define bswap_32(x) __bswap_32(x) -# define bswap_64(x) __bswap_64(x) +# define __BIG_ENDIAN 4321 +# define __LITTLE_ENDIAN 1234 +# define __BYTE_ORDER __LITTLE_ENDIAN #elif defined(__NetBSD__) # include <sys/bswap.h> @@ -93,14 +97,18 @@ #elif defined(__APPLE__) # include <CoreFoundation/CFByteOrder.h> -# define __BIG_ENDIAN CFByteOrderBigEndian -# define __LITTLE_ENDIAN CFByteOrderLittleEndian -# define __BYTE_ORDER (CFByteOrderGetCurrent) +# define __BIG_ENDIAN 4321 +# define __LITTLE_ENDIAN 1234 +#if (defined(__LITTLE_ENDIAN__) && (__LITTLE_ENDIAN__ == 1)) + #define __BYTE_ORDER __LITTLE_ENDIAN +#else + #define __BYTE_ORDER __BIG_ENDIAN +#endif # define bswap_16(x) CFSwapInt16(x) # define bswap_32(x) CFSwapInt32(x) # define bswap_64(x) CFSwapInt64(x) -#elif (defined(BSD) && (BSD >= 199103)) +#elif (defined(BSD) && (BSD >= 199103)) && !defined(__GLIBC__) # include <machine/endian.h> # define __BIG_ENDIAN _BIG_ENDIAN # define __LITTLE_ENDIAN _LITTLE_ENDIAN This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |