133280Sbostic /* 233280Sbostic * Copyright (c) 1987 Regents of the University of California. 333280Sbostic * All rights reserved. 433280Sbostic * 533280Sbostic * Redistribution and use in source and binary forms are permitted 6*34867Sbostic * provided that the above copyright notice and this paragraph are 7*34867Sbostic * duplicated in all such forms and that any documentation, 8*34867Sbostic * advertising materials, and other materials related to such 9*34867Sbostic * distribution and use acknowledge that the software was developed 10*34867Sbostic * by the University of California, Berkeley. The name of the 11*34867Sbostic * University may not be used to endorse or promote products derived 12*34867Sbostic * from this software without specific prior written permission. 13*34867Sbostic * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14*34867Sbostic * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15*34867Sbostic * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 1633280Sbostic * 17*34867Sbostic * @(#)endian.h 7.3 (Berkeley) 06/29/88 1833280Sbostic */ 1933280Sbostic 2033280Sbostic /* 2133280Sbostic * Definitions for byte order, 2233280Sbostic * according to byte significance from low address to high. 2333280Sbostic */ 2433280Sbostic #define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */ 2533280Sbostic #define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ 2633280Sbostic #define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */ 2733280Sbostic 2833280Sbostic #define BYTE_ORDER LITTLE_ENDIAN /* byte order on vax */ 2933280Sbostic 3033280Sbostic /* 3133280Sbostic * Macros for network/external number representation conversion. 3233280Sbostic */ 3333381Skarels #if BYTE_ORDER == BIG_ENDIAN && !defined(lint) 3433280Sbostic #define ntohl(x) (x) 3533280Sbostic #define ntohs(x) (x) 3633280Sbostic #define htonl(x) (x) 3733280Sbostic #define htons(x) (x) 3833280Sbostic #else 3933280Sbostic unsigned short ntohs(), htons(); 4033280Sbostic unsigned long ntohl(), htonl(); 4133280Sbostic #endif 42