2 +--------------------------------------------------------------------+
3 | libmemcached - C/C++ Client Library for memcached |
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted under the terms of the BSD license. |
7 | You should have received a copy of the license in a bundled file |
8 | named LICENSE; in case you did not receive a copy you can review |
9 | the terms online at: https://opensource.org/licenses/BSD-3-Clause |
10 +--------------------------------------------------------------------+
11 | Copyright (c) 2006-2014 Brian Aker https://datadifferential.com/ |
12 | Copyright (c) 2020 Michael Wallner <mike@php.net> |
13 +--------------------------------------------------------------------+
16 #include "mem_config.h"
18 #if HAVE_HTONLL && HAVE_ARPA_INET_H
19 # include <arpa/inet.h>
22 #include "libmemcached/byteorder.h"
24 /* Byte swap a 64-bit number. */
27 static inline uint64_t swap64(uint64_t in
) {
29 /* Little endian, flip the bytes around until someone makes a faster/better
32 for (uint8_t x
= 0; x
< 8; ++x
) {
33 rv
= (rv
<< 8) | (in
& 0xff);
38 /* big-endian machines don't need byte swapping */
40 # endif // WORDS_BIGENDIAN
45 #include <sys/types.h>
47 uint64_t memcached_ntohll(uint64_t value
) {
55 uint64_t memcached_htonll(uint64_t value
) {