Java字节序与大小端转换_我是怎么处理大小端及网络字节序的

#if defined(__ALPHA) || defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA)

#define POCO_ARCH POCO_ARCH_ALPHA

#define POCO_ARCH_LITTLE_ENDIAN 1

#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(EMSCRIPTEN) || defined(__EMSCRIPTEN__)

#define POCO_ARCH POCO_ARCH_IA32

#define POCO_ARCH_LITTLE_ENDIAN 1

#elif defined(_IA64) || defined(__IA64__) || defined(__ia64__) || defined(__ia64) || defined(_M_IA64)

#define POCO_ARCH POCO_ARCH_IA64

#if defined(hpux) || defined(_hpux)

#define POCO_ARCH_BIG_ENDIAN 1

#else

#define POCO_ARCH_LITTLE_ENDIAN 1

#endif

#elif defined(__x86_64__) || defined(_M_X64)

#define POCO_ARCH POCO_ARCH_AMD64

#define POCO_ARCH_LITTLE_ENDIAN 1

#elif defined(__mips__) || defined(__mips) || defined(__MIPS__) || defined(_M_MRX000)

#define POCO_ARCH POCO_ARCH_MIPS

#if defined(POCO_OS_FAMILY_WINDOWS)

// Is this OK? Supports windows only little endian??

#define POCO_ARCH_LITTLE_ENDIAN 1

#elif defined(__MIPSEB__) || defined(_MIPSEB) || defined(__MIPSEB)

#define POCO_ARCH_BIG_ENDIAN 1

#elif defined(__MIPSEL__) || defined(_MIPSEL) || defined(__MIPSEL)

#define POCO_ARCH_LITTLE_ENDIAN 1

#else

#error "MIPS but neither MIPSEL nor MIPSEB?"

#endif

#elif defined(__hppa) || defined(__hppa__)

#define POCO_ARCH POCO_ARCH_HPPA

#define POCO_ARCH_BIG_ENDIAN 1

#elif defined(__PPC) || defined(__POWERPC__) || defined(__powerpc) || defined(__PPC__) || \

defined(__powerpc__) || defined(__ppc__) || defined(__ppc) || defined(_ARCH_PPC) || defined(_M_PPC)

#define POCO_ARCH POCO_ARCH_PPC

#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)

#define POCO_ARCH_LITTLE_ENDIAN 1

#else

#define POCO_ARCH_BIG_ENDIAN 1

#endif

#elif defined(_POWER) || defined(_ARCH_PWR) || defined(_ARCH_PWR2) || defined(_ARCH_PWR3) || \

defined(_ARCH_PWR4) || defined(__THW_RS6000)

#define POCO_ARCH POCO_ARCH_POWER

#define POCO_ARCH_BIG_ENDIAN 1

#elif defined(__sparc__) || defined(__sparc) || defined(sparc)

#define POCO_ARCH POCO_ARCH_SPARC

#define POCO_ARCH_BIG_ENDIAN 1

#elif defined(__arm__) || defined(__arm) || defined(ARM) || defined(_ARM_) || defined(__ARM__) || defined(_M_ARM)

#define POCO_ARCH POCO_ARCH_ARM

#if defined(__ARMEB__)

#define POCO_ARCH_BIG_ENDIAN 1

#else

#define POCO_ARCH_LITTLE_ENDIAN 1

#endif

#elif defined(__arm64__) || defined(__arm64)

#define POCO_ARCH POCO_ARCH_ARM64

#if defined(__ARMEB__)

#define POCO_ARCH_BIG_ENDIAN 1

#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__

#define POCO_ARCH_BIG_ENDIAN 1

#else

#define POCO_ARCH_LITTLE_ENDIAN 1

#endif

#elif defined(__m68k__)

#define POCO_ARCH POCO_ARCH_M68K

#define POCO_ARCH_BIG_ENDIAN 1

#elif defined(__s390__)

#define POCO_ARCH POCO_ARCH_S390

#define POCO_ARCH_BIG_ENDIAN 1

#elif defined(__sh__) || defined(__sh) || defined(SHx) || defined(_SHX_)

#define POCO_ARCH POCO_ARCH_SH

#if defined(__LITTLE_ENDIAN__) || (POCO_OS == POCO_OS_WINDOWS_CE)

#define POCO_ARCH_LITTLE_ENDIAN 1

#else

#define POCO_ARCH_BIG_ENDIAN 1

#endif

#elif defined (nios2) || defined(__nios2) || defined(__nios2__)

#define POCO_ARCH POCO_ARCH_NIOS2

#if defined(__nios2_little_endian) || defined(nios2_little_endian) || defined(__nios2_little_endian__)

#define POCO_ARCH_LITTLE_ENDIAN 1

#else

#define POCO_ARCH_BIG_ENDIAN 1

#endif

#elif defined(__AARCH64EL__)

#define POCO_ARCH POCO_ARCH_AARCH64

#define POCO_ARCH_LITTLE_ENDIAN 1

#elif defined(__AARCH64EB__)

#define POCO_ARCH POCO_ARCH_AARCH64

#define POCO_ARCH_BIG_ENDIAN 1

#endif

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值