webmcp
diff libraries/moonhash/byteorder.h @ 502:fa902b26589f
Removed endianess detection from moonhash_sha.c and created byteorder.h for that purpose instead
author | jbe |
---|---|
date | Mon Aug 14 12:07:37 2017 +0200 (2017-08-14) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libraries/moonhash/byteorder.h Mon Aug 14 12:07:37 2017 +0200 1.3 @@ -0,0 +1,24 @@ 1.4 +/* Defines LITTLE_ENDIAN_DETECTED if system follows little endian byte order 1.5 + scheme. Does not define anything if endianess could not be determined. */ 1.6 + 1.7 +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) 1.8 +# include <sys/endian.h> 1.9 +# if defined(_BYTE_ORDER) && defined(_LITTLE_ENDIAN) 1.10 +# if _BYTE_ORDER == _LITTLE_ENDIAN 1.11 +# define LITTLE_ENDIAN_DETECTED 1.12 +# endif 1.13 +# else 1.14 +# warning Could not determine endianess on BSD platform, revert to fail safe. 1.15 +# endif 1.16 +#elif defined(__linux__) 1.17 +# include <endian.h> 1.18 +# if defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) 1.19 +# if __BYTE_ORDER == __LITTLE_ENDIAN 1.20 +# define LITTLE_ENDIAN_DETECTED 1.21 +# endif 1.22 +# else 1.23 +# warning Could not determine endianess on Linux platform, revert to fail safe. 1.24 +# endif 1.25 +#else 1.26 +# warning Could not determine endianess, revert to fail safe. 1.27 +#endif