Skip to content

Commit f90d899

Browse files
committed
Merge branch 'ss/bswap-ntohll-fix' into seen
* ss/bswap-ntohll-fix: bswap.h: Move the overwriting of the ntohl*/ htonl* macros.
2 parents edc37f5 + c55ec3a commit f90d899

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

compat/bswap.h

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -95,24 +95,6 @@ static inline uint64_t git_bswap64(uint64_t x)
9595

9696
#endif
9797

98-
#if defined(bswap32)
99-
100-
#undef ntohl
101-
#undef htonl
102-
#define ntohl(x) bswap32(x)
103-
#define htonl(x) bswap32(x)
104-
105-
#endif
106-
107-
#if defined(bswap64)
108-
109-
#undef ntohll
110-
#undef htonll
111-
#define ntohll(x) bswap64(x)
112-
#define htonll(x) bswap64(x)
113-
114-
#else
115-
11698
#undef ntohll
11799
#undef htonll
118100

@@ -151,10 +133,23 @@ static inline uint64_t git_bswap64(uint64_t x)
151133
# define ntohll(n) (n)
152134
# define htonll(n) (n)
153135
#else
154-
# define ntohll(n) default_bswap64(n)
155-
# define htonll(n) default_bswap64(n)
156-
#endif
157136

137+
# if defined(bswap32)
138+
# undef ntohl
139+
# undef htonl
140+
# define ntohl(x) bswap32(x)
141+
# define htonl(x) bswap32(x)
142+
# endif
143+
144+
# if defined(bswap64)
145+
# undef ntohll
146+
# undef htonll
147+
# define ntohll(x) bswap64(x)
148+
# define htonll(x) bswap64(x)
149+
# else
150+
# define ntohll(n) default_bswap64(n)
151+
# define htonll(n) default_bswap64(n)
152+
# endif
158153
#endif
159154

160155
static inline uint16_t get_be16(const void *ptr)

0 commit comments

Comments
 (0)