Merge in dist fix from Monty
[m6w6/libmemcached] / libmemcached / byteorder.h
1 /* LibMemcached
2 * Copyright (C) 2006-2009 Brian Aker
3 * All rights reserved.
4 *
5 * Use and distribution licensed under the BSD license. See
6 * the COPYING file in the parent directory for full text.
7 *
8 * Summary:
9 *
10 */
11
12 #ifndef __LIBMEMCACHED_BYTEORDER_H__
13 #define __LIBMEMCACHED_BYTEORDER_H__
14
15 #include "config.h"
16
17 #if HAVE_SYS_TYPES_H
18 #include <sys/types.h>
19 #endif
20
21
22 /* Define this here, which will turn on the visibilty controls while we're
23 * building libmemcached.
24 */
25 #define BUILDING_LIBMEMCACHED 1
26
27 #include "libmemcached/memcached.h"
28
29 #ifndef HAVE_HTONLL
30 #define ntohll(a) memcached_ntohll(a)
31 #define htonll(a) memcached_htonll(a)
32
33 LIBMEMCACHED_LOCAL
34 uint64_t memcached_ntohll(uint64_t);
35 LIBMEMCACHED_LOCAL
36 uint64_t memcached_htonll(uint64_t);
37 #endif
38
39 #ifdef linux
40 /* /usr/include/netinet/in.h defines macros from ntohs() to _bswap_nn to
41 * optimize the conversion functions, but the prototypes generate warnings
42 * from gcc. The conversion methods isn't the bottleneck for my app, so
43 * just remove the warnings by undef'ing the optimization ..
44 */
45 #undef ntohs
46 #undef ntohl
47 #undef htons
48 #undef htonl
49 #endif
50
51 #endif /*__LIBMEMCACHED_BYTEORDER_H__ */