#include "netinet/in.h"
#define UINT64 unsigned long long
#define UINT32 unsigned int
UINT64 ntohUINT64(UINT64 arg64)
{
UINT64 res64 = 0;
#if __BYTE_ORDER == __LITTLE_ENDIAN
UINT32 low = (UINT32) (arg64 & 0x00000000FFFFFFFFLL);
UINT32 high = (UINT32) ((arg64 & 0xFFFFFFFF00000000LL) >> 32);
low = ntohl(low);
high = ntohl(high);
res64 = (UINT64) high + (((UINT64) low) << 32);
#else
res64 = arg64;
#endif
return res64;
}
UINT64 htoUINT64(UINT64 arg64)
{
UINT64 res64 = 0;
#if __BYTE_ORDER == __LITTLE_ENDIAN
UINT32 low = (UINT32) (arg64 & 0x00000000FFFFFFFFLL);
UINT32 high = (UINT32) ((arg64 & 0xFFFFFFFF00000000LL) >> 32);
low = htonl(low);
high = htonl(high);
res64 = (UINT64) high + (((UINT64) low) << 32);
#else
res64 = arg64;
#endif
return res64;
}
阅读(2512) | 评论(0) | 转发(0) |