X-Git-Url: http://git.ozo.com/?p=openwrt-10.03%2F.git;a=blobdiff_plain;f=tools%2Finclude%2Fendian.h;fp=tools%2Finclude%2Fendian.h;h=4ea34cdd0f95c354ebc15bae00c54fb249f18db1;hp=0000000000000000000000000000000000000000;hb=652d9073459fce55104f0db8f64fc5b9100c979d;hpb=44af1866aa41cfbbad48583106cb82201ded4fcb diff --git a/tools/include/endian.h b/tools/include/endian.h new file mode 100644 index 000000000..4ea34cdd0 --- /dev/null +++ b/tools/include/endian.h @@ -0,0 +1,29 @@ +#ifndef __endian_compat_h +#define __endian_compat_h + +#if defined(__linux__) +#include_next +#elif defined(__APPLE__) +#include +#include +#define bswap_16(x) NXSwapShort(x) +#define bswap_32(x) NXSwapInt(x) +#define bswap_64(x) NXSwapLongLong(x) +#else +#include +#define bswap_16(x) swap16(x) +#define bswap_32(x) swap32(x) +#define bswap_64(x) swap64(x) +#endif + +#ifndef __BYTE_ORDER +#define __BYTE_ORDER BYTE_ORDER +#endif +#ifndef __BIG_ENDIAN +#define __BIG_ENDIAN BIG_ENDIAN +#endif +#ifndef __LITTLE_ENDIAN +#define __LITTLE_ENDIAN LITTLE_ENDIAN +#endif + +#endif