]> git.proxmox.com Git - mirror_zfs-debian.git/blobdiff - lib/libspl/include/sys/byteorder.h
New upstream version 0.7.2
[mirror_zfs-debian.git] / lib / libspl / include / sys / byteorder.h
index 528d2d208d6c274809e85d748e9a35b7e7e1e27d..72d40b1643a8b7d706a33deb8124bc8ea87f99ed 100644 (file)
@@ -128,6 +128,32 @@ extern     in_port_t ntohs(in_port_t);
 #define        BE_64(x)        BSWAP_64(x)
 #endif
 
+#ifdef _BIG_ENDIAN
+static __inline__ uint64_t
+htonll(uint64_t n)
+{
+       return (n);
+}
+
+static __inline__ uint64_t
+ntohll(uint64_t n)
+{
+       return (n);
+}
+#else
+static __inline__ uint64_t
+htonll(uint64_t n)
+{
+       return ((((uint64_t)htonl(n)) << 32) + htonl(n >> 32));
+}
+
+static __inline__ uint64_t
+ntohll(uint64_t n)
+{
+       return ((((uint64_t)ntohl(n)) << 32) + ntohl(n >> 32));
+}
+#endif
+
 /*
  * Macros to read unaligned values from a specific byte order to
  * native byte order