xref: /titanic_41/usr/src/lib/libc/sparc/gen/byteorder.c (revision 989f28072d20c73ae0955d6a1e3e2fc74831cb39)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #include <sys/isa_defs.h>
28 #include <sys/types.h>
29 
30 
31 #if defined(_LITTLE_ENDIAN) && !defined(__lint)
32 
33 #error	Use ISA-specific byteorder.s on a little-endian machine.
34 
35 #else	/* !_LITTLE_ENDIAN */
36 
37 /*
38  * htonll(), ntohll(), htonl(), ntohl(), htons(), ntohs()
39  * These functions just return the input parameter, as the host
40  * byte order is the same as the network byte order (big endian).
41  * On little endian machines, these functions byte swap.
42  */
43 
44 uint64_t
45 htonll(uint64_t in)
46 {
47 	return (in);
48 }
49 
50 uint64_t
51 ntohll(uint64_t in)
52 {
53 	return (in);
54 }
55 
56 uint32_t
57 htonl(uint32_t in)
58 {
59 	return (in);
60 }
61 
62 uint32_t
63 ntohl(uint32_t in)
64 {
65 	return (in);
66 }
67 
68 uint16_t
69 htons(uint16_t in)
70 {
71 	return (in);
72 }
73 
74 uint16_t
75 ntohs(uint16_t in)
76 {
77 	return (in);
78 }
79 
80 #endif	/* _LITTLE_ENDIAN */
81