xref: /csrg-svn/sys/hp300/include/endian.h (revision 33277)
1*33277Sbostic /*
2*33277Sbostic  * Copyright (c) 1987 Regents of the University of California.
3*33277Sbostic  * All rights reserved.
4*33277Sbostic  *
5*33277Sbostic  * Redistribution and use in source and binary forms are permitted
6*33277Sbostic  * provided that this notice is preserved and that due credit is given
7*33277Sbostic  * to the University of California at Berkeley. The name of the University
8*33277Sbostic  * may not be used to endorse or promote products derived from this
9*33277Sbostic  * software without specific prior written permission. This software
10*33277Sbostic  * is provided ``as is'' without express or implied warranty.
11*33277Sbostic  *
12*33277Sbostic  *	@(#)endian.h	7.1 (Berkeley) 01/07/88
13*33277Sbostic  */
14*33277Sbostic 
15*33277Sbostic /*
16*33277Sbostic  * Definitions for byte order,
17*33277Sbostic  * according to byte significance from low address to high.
18*33277Sbostic  */
19*33277Sbostic #define	LITTLE_ENDIAN	1234	/* least-significant byte first (vax) */
20*33277Sbostic #define	BIG_ENDIAN	4321	/* most-significant byte first (IBM, net) */
21*33277Sbostic #define	PDP_ENDIAN	3412	/* LSB first in word, MSW first in long (pdp) */
22*33277Sbostic 
23*33277Sbostic #define	BYTE_ORDER	BIG_ENDIAN	/* byte order on tahoe */
24*33277Sbostic 
25*33277Sbostic /*
26*33277Sbostic  * Macros for network/external number representation conversion.
27*33277Sbostic  */
28*33277Sbostic #if ENDIAN == BIG && !defined(lint)
29*33277Sbostic #define	ntohl(x)	(x)
30*33277Sbostic #define	ntohs(x)	(x)
31*33277Sbostic #define	htonl(x)	(x)
32*33277Sbostic #define	htons(x)	(x)
33*33277Sbostic #else
34*33277Sbostic unsigned short	ntohs(), htons();
35*33277Sbostic unsigned long	ntohl(), htonl();
36*33277Sbostic #endif
37