diff options
author | Naoki INADA <inada-n@eagle> | 2009-07-09 13:41:04 +0900 |
---|---|---|
committer | Naoki INADA <inada-n@eagle> | 2009-07-09 13:41:04 +0900 |
commit | 979efbb9501e14d43e2def8a80992494690a9d39 (patch) | |
tree | e20148732333833ffd965c492e0d3648465c8df5 /python | |
parent | 78db826a75d9f091f2175ace5f2cd9cb81c0f115 (diff) | |
download | msgpack-python-979efbb9501e14d43e2def8a80992494690a9d39.tar.gz |
Support MinGW.
Diffstat (limited to 'python')
-rw-r--r-- | python/msgpack/unpack_define.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/python/msgpack/unpack_define.h b/python/msgpack/unpack_define.h index 63668c2..d997569 100644 --- a/python/msgpack/unpack_define.h +++ b/python/msgpack/unpack_define.h @@ -45,8 +45,21 @@ extern "C" { #endif #endif +#ifdef __WIN32__ +static inline uint16_t msgpack_betoh16(uint16_t x) { + return ((x << 8) & 0xff00U) | + ((x >> 8) & 0x00ffU); +} +static inline uint32_t msgpack_betoh32(uint32_t x) { + return ((x << 24) & 0xff000000UL ) | + ((x << 8) & 0x00ff0000UL ) | + ((x >> 8) & 0x0000ff00UL ) | + ((x >> 24) & 0x000000ffUL ); +} +#else #define msgpack_betoh16(x) ntohs(x) #define msgpack_betoh32(x) ntohl(x) +#endif #ifdef __LITTLE_ENDIAN__ #if defined(__bswap_64) |