From: <sch...@us...> - 2012-04-24 07:58:23
|
Revision: 10320 http://octave.svn.sourceforge.net/octave/?rev=10320&view=rev Author: schloegl Date: 2012-04-24 07:58:12 +0000 (Tue, 24 Apr 2012) Log Message: ----------- better platform checks 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 07:23:15 UTC (rev 10319) +++ trunk/octave-forge/extra/NaN/src/xptopen.cpp 2012-04-24 07:58:12 UTC (rev 10320) @@ -72,12 +72,15 @@ #define max(a,b) (((a) > (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b)) + #if 0 #elif defined(__linux__) +# include <endian.h> # include <byteswap.h> #elif defined(__GLIBC__) // for Hurd +# include <endian.h> # include <byteswap.h> #elif defined(__MINGW32__) @@ -130,8 +133,11 @@ # define __LITTLE_ENDIAN 1234 # define __BYTE_ORDER __BIG_ENDIAN +#else +# error Unknown platform #endif +#if defined(__MINGW32__) || defined(__sparc__) # ifndef bswap_16 # define bswap_16(x) \ @@ -159,7 +165,18 @@ | (((x) & 0x00000000000000ffull) << 56)) # endif +#endif + +#if !defined(__BIG_ENDIAN) && !defined(__LITTLE_ENDIAN) +#error ENDIANITY is not known +#endif + +#if !defined(bswap_16) || !defined(bswap_32) || !defined(bswap_64) +#error SWAP operation not available +#endif + + #if __BYTE_ORDER == __BIG_ENDIAN #define l_endian_u16(x) ((uint16_t)bswap_16((uint16_t)(x))) #define l_endian_u32(x) ((uint32_t)bswap_32((uint32_t)(x))) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |