File: ntoh.c

package info (click to toggle)
pgplot5 5.2.2-19.3
  • links: PTS
  • area: non-free
  • in suites: buster, stretch
  • size: 7,136 kB
  • ctags: 6,763
  • sloc: fortran: 39,792; ansic: 22,549; objc: 1,534; sh: 1,298; makefile: 385; perl: 234; pascal: 233; tcl: 190; awk: 51; csh: 25
file content (21 lines) | stat: -rw-r--r-- 487 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* These routines convert fmmo network to host byte order and back.  They */
/* should only be used on machines where the OS does not already define */
/* the relevant functions */

/* Sam Southard, Jr. */
/* Created: 22-Apr-1993 */

unsigned short ntohs (netshort)
unsigned short netshort;
{
	unsigned short retval;

	retval = (((netshort & 0xFF) << 8) | (netshort >> 8));
	return (retval);
}

unsigned short htons (hostshort)
unsigned short hostshort;
{
	return (ntohs (hostshort));
}