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 633277Sbostic * provided that this notice is preserved and that due credit is given 733277Sbostic * to the University of California at Berkeley. The name of the University 833277Sbostic * may not be used to endorse or promote products derived from this 933277Sbostic * software without specific prior written permission. This software 1033277Sbostic * is provided ``as is'' without express or implied warranty. 1133277Sbostic * 12*33380Skarels * @(#)endian.h 7.2 (Berkeley) 01/21/88 1333277Sbostic */ 1433277Sbostic 1533277Sbostic /* 1633277Sbostic * Definitions for byte order, 1733277Sbostic * according to byte significance from low address to high. 1833277Sbostic */ 1933277Sbostic #define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */ 2033277Sbostic #define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ 2133277Sbostic #define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */ 2233277Sbostic 2333277Sbostic #define BYTE_ORDER BIG_ENDIAN /* byte order on tahoe */ 2433277Sbostic 2533277Sbostic /* 2633277Sbostic * Macros for network/external number representation conversion. 2733277Sbostic */ 28*33380Skarels #if BYTE_ORDER == BIG_ENDIAN && !defined(lint) 2933277Sbostic #define ntohl(x) (x) 3033277Sbostic #define ntohs(x) (x) 3133277Sbostic #define htonl(x) (x) 3233277Sbostic #define htons(x) (x) 3333277Sbostic #else 3433277Sbostic unsigned short ntohs(), htons(); 3533277Sbostic unsigned long ntohl(), htonl(); 3633277Sbostic #endif 37