diff options
Diffstat (limited to 'sys/alpha/include/endian.h')
-rw-r--r-- | sys/alpha/include/endian.h | 55 |
1 files changed, 10 insertions, 45 deletions
diff --git a/sys/alpha/include/endian.h b/sys/alpha/include/endian.h index 0ba53cd..d9e64c8 100644 --- a/sys/alpha/include/endian.h +++ b/sys/alpha/include/endian.h @@ -1,7 +1,4 @@ -/* $FreeBSD$ */ -/* From: NetBSD: endian.h,v 1.5 1997/10/09 15:42:19 bouyer Exp */ - -/* +/*- * Copyright (c) 1987, 1991, 1993 * The Regents of the University of California. All rights reserved. * @@ -34,10 +31,14 @@ * SUCH DAMAGE. * * @(#)endian.h 8.1 (Berkeley) 6/10/93 + * $NetBSD: endian.h,v 1.5 1997/10/09 15:42:19 bouyer Exp $ + * $FreeBSD$ */ -#ifndef _ENDIAN_H_ -#define _ENDIAN_H_ +#ifndef _MACHINE_ENDIAN_H_ +#define _MACHINE_ENDIAN_H_ + +#include <machine/ansi.h> /* * Define the order of 32-bit words in 64-bit words. @@ -45,52 +46,16 @@ #define _QUAD_HIGHWORD 1 #define _QUAD_LOWWORD 0 -#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 LITTLE_ENDIAN - -#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) (x) -#define NTOHS(x) (x) -#define HTONL(x) (x) -#define HTONS(x) (x) - -#else - -#define NTOHL(x) (x) = ntohl((__uint32_t)x) -#define NTOHS(x) (x) = ntohs((__uint16_t)x) -#define HTONL(x) (x) = htonl((__uint32_t)x) -#define HTONS(x) (x) = htons((__uint16_t)x) -#endif #endif /* !_POSIX_SOURCE */ -#endif /* !_ENDIAN_H_ */ + +#endif /* !_MACHINE_ENDIAN_H_ */ |