xref: /onnv-gate/usr/src/lib/libc/sparc/gen/byteorder.c (revision 7421:8b7f030a1d82)
14271Srie /*
24271Srie  * CDDL HEADER START
34271Srie  *
44271Srie  * The contents of this file are subject to the terms of the
54271Srie  * Common Development and Distribution License (the "License").
64271Srie  * You may not use this file except in compliance with the License.
74271Srie  *
84271Srie  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
94271Srie  * or http://www.opensolaris.org/os/licensing.
104271Srie  * See the License for the specific language governing permissions
114271Srie  * and limitations under the License.
124271Srie  *
134271Srie  * When distributing Covered Code, include this CDDL HEADER in each
144271Srie  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
154271Srie  * If applicable, add the following below this CDDL HEADER, with the
164271Srie  * fields enclosed by brackets "[]" replaced with your own identifying
174271Srie  * information: Portions Copyright [yyyy] [name of copyright owner]
184271Srie  *
194271Srie  * CDDL HEADER END
204271Srie  */
214271Srie 
224271Srie /*
23*7421SDaniel.Anderson@Sun.COM  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
244271Srie  * Use is subject to license terms.
254271Srie  */
264271Srie 
274271Srie #include <sys/isa_defs.h>
284271Srie #include <sys/types.h>
294271Srie 
304271Srie 
314271Srie #if defined(_LITTLE_ENDIAN) && !defined(__lint)
324271Srie 
334271Srie #error	Use ISA-specific byteorder.s on a little-endian machine.
344271Srie 
354271Srie #else	/* !_LITTLE_ENDIAN */
364271Srie 
37*7421SDaniel.Anderson@Sun.COM /*
38*7421SDaniel.Anderson@Sun.COM  * htonll(), ntohll(), htonl(), ntohl(), htons(), ntohs()
39*7421SDaniel.Anderson@Sun.COM  * These functions just return the input parameter, as the host
40*7421SDaniel.Anderson@Sun.COM  * byte order is the same as the network byte order (big endian).
41*7421SDaniel.Anderson@Sun.COM  * On little endian machines, these functions byte swap.
42*7421SDaniel.Anderson@Sun.COM  */
43*7421SDaniel.Anderson@Sun.COM 
44*7421SDaniel.Anderson@Sun.COM uint64_t
htonll(uint64_t in)45*7421SDaniel.Anderson@Sun.COM htonll(uint64_t in)
46*7421SDaniel.Anderson@Sun.COM {
47*7421SDaniel.Anderson@Sun.COM 	return (in);
48*7421SDaniel.Anderson@Sun.COM }
49*7421SDaniel.Anderson@Sun.COM 
50*7421SDaniel.Anderson@Sun.COM uint64_t
ntohll(uint64_t in)51*7421SDaniel.Anderson@Sun.COM ntohll(uint64_t in)
52*7421SDaniel.Anderson@Sun.COM {
53*7421SDaniel.Anderson@Sun.COM 	return (in);
54*7421SDaniel.Anderson@Sun.COM }
55*7421SDaniel.Anderson@Sun.COM 
564271Srie uint32_t
htonl(uint32_t in)574271Srie htonl(uint32_t in)
584271Srie {
594271Srie 	return (in);
604271Srie }
614271Srie 
624271Srie uint32_t
ntohl(uint32_t in)634271Srie ntohl(uint32_t in)
644271Srie {
654271Srie 	return (in);
664271Srie }
674271Srie 
684271Srie uint16_t
htons(uint16_t in)694271Srie htons(uint16_t in)
704271Srie {
714271Srie 	return (in);
724271Srie }
734271Srie 
744271Srie uint16_t
ntohs(uint16_t in)754271Srie ntohs(uint16_t in)
764271Srie {
774271Srie 	return (in);
784271Srie }
794271Srie 
804271Srie #endif	/* _LITTLE_ENDIAN */
81