Skip to content

Commit 77ca35a

Browse files
author
Naoki INADA
committed
Support MinGW.
1 parent 2f09551 commit 77ca35a

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

msgpack/unpack_define.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,21 @@ extern "C" {
4545
#endif
4646
#endif
4747

48+
#ifdef __WIN32__
49+
static inline uint16_t msgpack_betoh16(uint16_t x) {
50+
return ((x << 8) & 0xff00U) |
51+
((x >> 8) & 0x00ffU);
52+
}
53+
static inline uint32_t msgpack_betoh32(uint32_t x) {
54+
return ((x << 24) & 0xff000000UL ) |
55+
((x << 8) & 0x00ff0000UL ) |
56+
((x >> 8) & 0x0000ff00UL ) |
57+
((x >> 24) & 0x000000ffUL );
58+
}
59+
#else
4860
#define msgpack_betoh16(x) ntohs(x)
4961
#define msgpack_betoh32(x) ntohl(x)
62+
#endif
5063

5164
#ifdef __LITTLE_ENDIAN__
5265
#if defined(__bswap_64)

0 commit comments

Comments
 (0)