Fix compilation on Linux (lacks ntohll etc)
[m6w6/libmemcached] / libmemcached / byteorder.h
1 #ifndef LIBMEMCACHED_BYTEORDER_H
2 #define LIBMEMCACHED_BYTEORDER_H
3
4 #include "config.h"
5
6 /* Define this here, which will turn on the visibilty controls while we're
7 * building libmemcached.
8 */
9 #define BUILDING_LIBMEMCACHED 1
10
11 #include "libmemcached/memcached.h"
12
13 #ifndef HAVE_HTONLL
14 LIBMEMCACHED_LOCAL
15 extern uint64_t ntohll(uint64_t);
16 LIBMEMCACHED_LOCAL
17 extern uint64_t htonll(uint64_t);
18 #endif
19
20 #ifdef linux
21 /* /usr/include/netinet/in.h defines macros from ntohs() to _bswap_nn to
22 * optimize the conversion functions, but the prototypes generate warnings
23 * from gcc. The conversion methods isn't the bottleneck for my app, so
24 * just remove the warnings by undef'ing the optimization ..
25 */
26 #undef ntohs
27 #undef ntohl
28 #undef htons
29 #undef htonl
30 #endif
31
32 #endif /* LIBMEMCACHED_BYTEORDER_H */