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