133277Sbostic /* 233277Sbostic * Copyright (c) 1987 Regents of the University of California. 333277Sbostic * All rights reserved. 433277Sbostic * 5*44526Sbostic * %sccs.include.redist.c% 633277Sbostic * 7*44526Sbostic * @(#)endian.h 7.5 (Berkeley) 06/28/90 833277Sbostic */ 933277Sbostic 1033277Sbostic /* 1133277Sbostic * Definitions for byte order, 1233277Sbostic * according to byte significance from low address to high. 1333277Sbostic */ 1433277Sbostic #define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */ 1533277Sbostic #define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ 1633277Sbostic #define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */ 1733277Sbostic 1833277Sbostic #define BYTE_ORDER BIG_ENDIAN /* byte order on tahoe */ 1933277Sbostic 2033277Sbostic /* 2133277Sbostic * Macros for network/external number representation conversion. 2233277Sbostic */ 2333380Skarels #if BYTE_ORDER == BIG_ENDIAN && !defined(lint) 2433277Sbostic #define ntohl(x) (x) 2533277Sbostic #define ntohs(x) (x) 2633277Sbostic #define htonl(x) (x) 2733277Sbostic #define htons(x) (x) 2840611Skarels 2940611Skarels #define NTOHL(x) (x) 3040611Skarels #define NTOHS(x) (x) 3140611Skarels #define HTONL(x) (x) 3240611Skarels #define HTONS(x) (x) 3340611Skarels 3433277Sbostic #else 3540611Skarels 3633277Sbostic unsigned short ntohs(), htons(); 3733277Sbostic unsigned long ntohl(), htonl(); 3840611Skarels 3940611Skarels #define NTOHL(x) (x) = ntohl(x) 4040611Skarels #define NTOHS(x) (x) = ntohs(x) 4140611Skarels #define HTONL(x) (x) = htonl(x) 4240611Skarels #define HTONS(x) (x) = htons(x) 4333277Sbostic #endif 44