1byteorder(3) z88dk Programmer's Manual byteorder(3)
2
3
4
6 htonl, htons, ntohl, ntohs - convert values between host and network
7 byte order
8
10 #include <net/hton.h>
11
12 unsigned long int htonl(unsigned long int hostlong);
13
14 unsigned short int htons(unsigned short int hostshort);
15
16 unsigned long int ntohl(unsigned long int netlong);
17
18 unsigned short int ntohs(unsigned short int netshort);
19
21 The htonl() function converts the long integer hostlong from host byte
22 order to network byte order.
23
24 The htons() function converts the short integer hostshort from host
25 byte order to network byte order.
26
27 The ntohl() function converts the long integer netlong from network
28 byte order to host byte order.
29
30 The ntohs() function converts the short integer netshort from network
31 byte order to host byte order.
32
33 On the z80 the host byte order is Least Significant Byte first, whereas
34 the network byte order, as used on the Internet, is Most Significant
35 Byte first.
36
38 BSD 4.3
39
41 Unlike on other machines these functions are not provided through
42 macros - they are instead functions kept in z80_crt0.lib. The optimiza‐
43 tion rules supplied with z88dk are aware of these routines and when
44 appropriate optimize the function call away.
45
47 Dominic Morris <dom@jb.man.ac.uk>
48
49 Original manual page by David Metcalfe <david@prism.demon.co.uk>
50
51
52
53BSD February 18 2000 byteorder(3)