|
|
1.1 root 1: /*
2: * Copyright (c) 1987 Regents of the University of California.
3: * All rights reserved.
4: *
5: * Redistribution is only permitted until one year after the first shipment
6: * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and
7: * binary forms are permitted provided that: (1) source distributions retain
8: * this entire copyright notice and comment, and (2) distributions including
9: * binaries display the following acknowledgement: This product includes
10: * software developed by the University of California, Berkeley and its
11: * contributors'' in the documentation or other materials provided with the
12: * distribution and in all advertising materials mentioning features or use
13: * of this software. Neither the name of the University nor the names of
14: * its contributors may be used to endorse or promote products derived from
15: * this software without specific prior written permission.
16: * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
17: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
18: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19: *
20: * @(#)endian.h 7.5 (Berkeley) 5/8/90
21: */
22:
23: /*
24: * Definitions for byte order,
25: * according to byte significance from low address to high.
26: */
27: #define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */
28: #define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */
29: #define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */
30:
31: #define BYTE_ORDER BIG_ENDIAN /* byte order on mc68000 */
32:
33: /*
34: * Macros for network/external number representation conversion.
35: */
36: #if BYTE_ORDER == BIG_ENDIAN && !defined(lint)
37: #define ntohl(x) (x)
38: #define ntohs(x) (x)
39: #define htonl(x) (x)
40: #define htons(x) (x)
41:
42: #define NTOHL(x) (x)
43: #define NTOHS(x) (x)
44: #define HTONL(x) (x)
45: #define HTONS(x) (x)
46:
47: #else
48:
49: unsigned short ntohs(), htons();
50: unsigned long ntohl(), htonl();
51:
52: #define NTOHL(x) (x) = ntohl(x)
53: #define NTOHS(x) (x) = ntohs(x)
54: #define HTONL(x) (x) = htonl(x)
55: #define HTONS(x) (x) = htons(x)
56: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.