diff options
Diffstat (limited to 'sys/sparc64/include/endian.h')
-rw-r--r-- | sys/sparc64/include/endian.h | 54 |
1 files changed, 16 insertions, 38 deletions
diff --git a/sys/sparc64/include/endian.h b/sys/sparc64/include/endian.h index 54cc62474012..532daabd9bb9 100644 --- a/sys/sparc64/include/endian.h +++ b/sys/sparc64/include/endian.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1987, 1991, 1993 * The Regents of the University of California. All rights reserved. * @@ -10,6 +10,13 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -30,58 +37,29 @@ #ifndef _MACHINE_ENDIAN_H_ #define _MACHINE_ENDIAN_H_ +#include <machine/ansi.h> + /* * Define the order of 32-bit words in 64-bit words. */ #define _QUAD_HIGHWORD 0 #define _QUAD_LOWWORD 1 -#ifndef _POSIX_SOURCE /* * Definitions for byte order, according to byte significance from low * address to high. */ +#ifndef _POSIX_SOURCE #define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ #define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ #define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ #define BYTE_ORDER BIG_ENDIAN +#endif /* !_POSIX_SOURCE */ -#ifndef _KERNEL -#include <sys/cdefs.h> -#endif -#include <machine/ansi.h> - -__BEGIN_DECLS -__uint32_t htonl __P((__uint32_t)); -__uint16_t htons __P((__uint16_t)); -__uint32_t ntohl __P((__uint32_t)); -__uint16_t ntohs __P((__uint16_t)); -__uint16_t bswap16 __P((__uint16_t)); -__uint32_t bswap32 __P((__uint32_t)); -__uint64_t bswap64 __P((__uint64_t)); -__END_DECLS - -/* - * Macros for network/external number representation conversion. - */ -#if BYTE_ORDER == BIG_ENDIAN && !defined(lint) -#define ntohl(x) (x) -#define ntohs(x) (x) -#define htonl(x) (x) -#define htons(x) (x) - -#define NTOHL(x) -#define NTOHS(x) -#define HTONL(x) -#define HTONS(x) - -#else +#define __htonl(x) (x) +#define __htons(x) (x) +#define __ntohl(x) (x) +#define __ntohs(x) (x) -#define NTOHL(x) (x) = ntohl((in_addr_t)x) -#define NTOHS(x) (x) = ntohs((in_port_t)x) -#define HTONL(x) (x) = htonl((in_addr_t)x) -#define HTONS(x) (x) = htons((in_port_t)x) -#endif -#endif /* !_POSIX_SOURCE */ #endif /* !_MACHINE_ENDIAN_H_ */ |