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,33 ****
*
* CDDL HEADER END
*/
/*
! * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
- #pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/isa_defs.h>
#include <sys/types.h>
#if defined(_LITTLE_ENDIAN) && !defined(__lint)
--- 18,31 ----
*
* CDDL HEADER END
*/
/*
! * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/isa_defs.h>
#include <sys/types.h>
#if defined(_LITTLE_ENDIAN) && !defined(__lint)
*** 34,43 ****
--- 32,60 ----
#error Use ISA-specific byteorder.s on a little-endian machine.
#else /* !_LITTLE_ENDIAN */
+ /*
+ * htonll(), ntohll(), htonl(), ntohl(), htons(), ntohs()
+ * These functions just return the input parameter, as the host
+ * byte order is the same as the network byte order (big endian).
+ * On little endian machines, these functions byte swap.
+ */
+
+ uint64_t
+ htonll(uint64_t in)
+ {
+ return (in);
+ }
+
+ uint64_t
+ ntohll(uint64_t in)
+ {
+ return (in);
+ }
+
uint32_t
htonl(uint32_t in)
{
return (in);
}