Print this page
5007142 Add ntohll and htonll to sys/byteorder.h
6717509 Need to use bswap/bswapq for byte swap of 64-bit integer on x32/x64
PSARC 2008/474

@@ -18,11 +18,11 @@
  *
  * CDDL HEADER END
  */
 
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
 /*      Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T     */
 /*        All Rights Reserved   */

@@ -38,12 +38,10 @@
  */
 
 #ifndef _SYS_BYTEORDER_H
 #define _SYS_BYTEORDER_H
 
-#pragma ident   "%Z%%M% %I%     %E% SMI"
-
 #include <sys/isa_defs.h>
 #include <sys/int_types.h>
 
 #if defined(__GNUC__) && defined(_ASM_INLINES) && \
         (defined(__i386) || defined(__amd64))

@@ -59,12 +57,14 @@
  */
 
 #if defined(_BIG_ENDIAN) && !defined(ntohl) && !defined(__lint)
 /* big-endian */
 #define ntohl(x)        (x)
+#define ntohll(x)       (x)
 #define ntohs(x)        (x)
 #define htonl(x)        (x)
+#define htonll(x)       (x)
 #define htons(x)        (x)
 
 #elif !defined(ntohl) /* little-endian */
 
 #ifndef _IN_PORT_T

@@ -86,10 +86,14 @@
 extern  in_addr_t htonl(in_addr_t);
 extern  in_port_t htons(in_port_t);
 extern  in_addr_t ntohl(in_addr_t);
 extern  in_port_t ntohs(in_port_t);
 #endif  /* !defined(_XPG4_2) || defined(__EXTENSIONS__) || defined(_XPG5) */
+#if !(defined(_XPG4_2) || defined(_XPG5)) || defined(__EXTENSIONS__)
+extern  uint64_t htonll(uint64_t);
+extern  uint64_t ntohll(uint64_t);
+#endif  /* !(_XPG4_2||_XPG5) || __EXTENSIONS__ */
 #endif
 
 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
 
 /*