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