00001 #ifndef HELPERS_H_
00002 #define HELPERS_H_
00003
00004 #include <inttypes.h>
00005
00006 #if defined(__APPLE_CC__)
00007 #define IS_BIG_ENDIAN
00008 #endif
00009
00010 #if defined WORDS_BIGENDIAN || defined IS_BIG_ENDIAN
00011
00012
00013
00014 #define LITTLE_TO_NATIVE16(x) (((((uint16_t) x) & 0xFF) << 8) | \
00015 (((uint16_t) x) >> 8))
00016 #define LITTLE_TO_NATIVE32(x) (((((uint32_t) x) & 0xFF) << 24) | \
00017 (((((uint32_t) x) >> 8) & 0xFF) << 16) | \
00018 (((((uint32_t) x) >> 16) & 0xFF) << 8) | \
00019 (((uint32_t) x) >> 24))
00020 #else
00021 #define LITTLE_TO_NATIVE16(x) x
00022 #define LITTLE_TO_NATIVE32(x) x
00023 #endif
00024
00025
00026
00027 #endif