2 * Copyright (C) 2006-2009 Brian Aker
5 * Use and distribution licensed under the BSD license. See
6 * the COPYING file in the parent directory for full text.
12 #include "byteorder.h"
14 /* Byte swap a 64-bit number. */
16 static inline uint64_t swap64(uint64_t in
)
18 #ifndef WORDS_BIGENDIAN
19 /* Little endian, flip the bytes around until someone makes a faster/better
22 for (uint8_t x
= 0; x
< 8; x
++)
24 rv
= (rv
<< 8) | (in
& 0xff);
29 /* big-endian machines don't need byte swapping */
31 #endif // WORDS_BIGENDIAN
35 uint64_t ntohll(uint64_t value
)
40 uint64_t htonll(uint64_t value
)