xref: /csrg-svn/sys/hp300/include/endian.h (revision 34863)
133277Sbostic /*
233277Sbostic  * Copyright (c) 1987 Regents of the University of California.
333277Sbostic  * All rights reserved.
433277Sbostic  *
533277Sbostic  * Redistribution and use in source and binary forms are permitted
6*34863Sbostic  * provided that the above copyright notice and this paragraph are
7*34863Sbostic  * duplicated in all such forms and that any documentation,
8*34863Sbostic  * advertising materials, and other materials related to such
9*34863Sbostic  * distribution and use acknowledge that the software was developed
10*34863Sbostic  * by the University of California, Berkeley.  The name of the
11*34863Sbostic  * University may not be used to endorse or promote products derived
12*34863Sbostic  * from this software without specific prior written permission.
13*34863Sbostic  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14*34863Sbostic  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15*34863Sbostic  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1633277Sbostic  *
17*34863Sbostic  *	@(#)endian.h	7.3 (Berkeley) 06/29/88
1833277Sbostic  */
1933277Sbostic 
2033277Sbostic /*
2133277Sbostic  * Definitions for byte order,
2233277Sbostic  * according to byte significance from low address to high.
2333277Sbostic  */
2433277Sbostic #define	LITTLE_ENDIAN	1234	/* least-significant byte first (vax) */
2533277Sbostic #define	BIG_ENDIAN	4321	/* most-significant byte first (IBM, net) */
2633277Sbostic #define	PDP_ENDIAN	3412	/* LSB first in word, MSW first in long (pdp) */
2733277Sbostic 
2833277Sbostic #define	BYTE_ORDER	BIG_ENDIAN	/* byte order on tahoe */
2933277Sbostic 
3033277Sbostic /*
3133277Sbostic  * Macros for network/external number representation conversion.
3233277Sbostic  */
3333380Skarels #if BYTE_ORDER == BIG_ENDIAN && !defined(lint)
3433277Sbostic #define	ntohl(x)	(x)
3533277Sbostic #define	ntohs(x)	(x)
3633277Sbostic #define	htonl(x)	(x)
3733277Sbostic #define	htons(x)	(x)
3833277Sbostic #else
3933277Sbostic unsigned short	ntohs(), htons();
4033277Sbostic unsigned long	ntohl(), htonl();
4133277Sbostic #endif
42