File: ntoh.c

package info (click to toggle)
pgplot5 5.2-13
  • links: PTS
  • area: non-free
  • in suites: potato
  • size: 6,280 kB
  • ctags: 5,903
  • sloc: fortran: 37,938; ansic: 18,809; sh: 1,147; objc: 532; makefile: 363; perl: 234; pascal: 233; tcl: 178; 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));
}