17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5f808c858Sraf * Common Development and Distribution License (the "License").
6f808c858Sraf * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate *
87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate * and limitations under the License.
127c478bd9Sstevel@tonic-gate *
137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate *
197c478bd9Sstevel@tonic-gate * CDDL HEADER END
207c478bd9Sstevel@tonic-gate */
21f808c858Sraf
227c478bd9Sstevel@tonic-gate /*
23*4b56a003SDaniel Anderson * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
247c478bd9Sstevel@tonic-gate * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate */
267c478bd9Sstevel@tonic-gate
277c478bd9Sstevel@tonic-gate #include <sys/isa_defs.h>
287c478bd9Sstevel@tonic-gate #include <sys/types.h>
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gate
31f808c858Sraf #if defined(_LITTLE_ENDIAN) && !defined(__lint)
32f808c858Sraf
337c478bd9Sstevel@tonic-gate #error Use ISA-specific byteorder.s on a little-endian machine.
347c478bd9Sstevel@tonic-gate
357c478bd9Sstevel@tonic-gate #else /* !_LITTLE_ENDIAN */
367c478bd9Sstevel@tonic-gate
37*4b56a003SDaniel Anderson /*
38*4b56a003SDaniel Anderson * htonll(), ntohll(), htonl(), ntohl(), htons(), ntohs()
39*4b56a003SDaniel Anderson * These functions just return the input parameter, as the host
40*4b56a003SDaniel Anderson * byte order is the same as the network byte order (big endian).
41*4b56a003SDaniel Anderson * On little endian machines, these functions byte swap.
42*4b56a003SDaniel Anderson */
43*4b56a003SDaniel Anderson
44*4b56a003SDaniel Anderson uint64_t
htonll(uint64_t in)45*4b56a003SDaniel Anderson htonll(uint64_t in)
46*4b56a003SDaniel Anderson {
47*4b56a003SDaniel Anderson return (in);
48*4b56a003SDaniel Anderson }
49*4b56a003SDaniel Anderson
50*4b56a003SDaniel Anderson uint64_t
ntohll(uint64_t in)51*4b56a003SDaniel Anderson ntohll(uint64_t in)
52*4b56a003SDaniel Anderson {
53*4b56a003SDaniel Anderson return (in);
54*4b56a003SDaniel Anderson }
55*4b56a003SDaniel Anderson
567c478bd9Sstevel@tonic-gate uint32_t
htonl(uint32_t in)577c478bd9Sstevel@tonic-gate htonl(uint32_t in)
587c478bd9Sstevel@tonic-gate {
597c478bd9Sstevel@tonic-gate return (in);
607c478bd9Sstevel@tonic-gate }
617c478bd9Sstevel@tonic-gate
627c478bd9Sstevel@tonic-gate uint32_t
ntohl(uint32_t in)637c478bd9Sstevel@tonic-gate ntohl(uint32_t in)
647c478bd9Sstevel@tonic-gate {
657c478bd9Sstevel@tonic-gate return (in);
667c478bd9Sstevel@tonic-gate }
677c478bd9Sstevel@tonic-gate
687c478bd9Sstevel@tonic-gate uint16_t
htons(uint16_t in)697c478bd9Sstevel@tonic-gate htons(uint16_t in)
707c478bd9Sstevel@tonic-gate {
717c478bd9Sstevel@tonic-gate return (in);
727c478bd9Sstevel@tonic-gate }
737c478bd9Sstevel@tonic-gate
747c478bd9Sstevel@tonic-gate uint16_t
ntohs(uint16_t in)757c478bd9Sstevel@tonic-gate ntohs(uint16_t in)
767c478bd9Sstevel@tonic-gate {
777c478bd9Sstevel@tonic-gate return (in);
787c478bd9Sstevel@tonic-gate }
79f808c858Sraf
807c478bd9Sstevel@tonic-gate #endif /* _LITTLE_ENDIAN */
81