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