projects
/
m6w6
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Patches from Piotr Sikora < piotr.sikora@frickle.com > for OpenBSD.
[m6w6/libmemcached]
/
libmemcached
/
byteorder.c
diff --git
a/libmemcached/byteorder.c
b/libmemcached/byteorder.c
index 24f8e8c6e88e1e13be7595325dd51c7f8b266c76..96a39bf88ff7d8fc166182b56c197ede274b24af 100644
(file)
--- a/
libmemcached/byteorder.c
+++ b/
libmemcached/byteorder.c
@@
-1,14
+1,25
@@
+/* LibMemcached
+ * Copyright (C) 2006-2009 Brian Aker
+ * All rights reserved.
+ *
+ * Use and distribution licensed under the BSD license. See
+ * the COPYING file in the parent directory for full text.
+ *
+ * Summary:
+ *
+ */
+
#include "byteorder.h"
/* Byte swap a 64-bit number. */
#include "byteorder.h"
/* Byte swap a 64-bit number. */
+#ifndef swap64
static inline uint64_t swap64(uint64_t in)
{
#ifndef WORDS_BIGENDIAN
/* Little endian, flip the bytes around until someone makes a faster/better
* way to do this. */
uint64_t rv= 0;
static inline uint64_t swap64(uint64_t in)
{
#ifndef WORDS_BIGENDIAN
/* Little endian, flip the bytes around until someone makes a faster/better
* way to do this. */
uint64_t rv= 0;
- uint8_t x= 0;
- for(x= 0; x < 8; x++)
+ for (uint8_t x= 0; x < 8; x++)
{
rv= (rv << 8) | (in & 0xff);
in >>= 8;
{
rv= (rv << 8) | (in & 0xff);
in >>= 8;
@@
-17,8
+28,9
@@
static inline uint64_t swap64(uint64_t in)
#else
/* big-endian machines don't need byte swapping */
return in;
#else
/* big-endian machines don't need byte swapping */
return in;
-#endif
+#endif
// WORDS_BIGENDIAN
}
}
+#endif
uint64_t ntohll(uint64_t value)
{
uint64_t ntohll(uint64_t value)
{