need DEFS.h for ASMSTR macro
[unix-history] / usr / src / lib / libc / mips / net / htons.s
CommitLineData
526b7415
KB
1/*-
2 * Copyright (c) 1991 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Ralph Campbell.
7 *
8 * %sccs.include.redist.c%
9 */
10
f1e99c02
KB
11#include "DEFS.h"
12
526b7415 13#if defined(LIBC_SCCS) && !defined(lint)
f1e99c02 14 ASMSTR("@(#)htons.s 5.2 (Berkeley) %G%")
526b7415
KB
15#endif /* LIBC_SCCS and not lint */
16
526b7415
KB
17/*
18 * netorder = htons(hostorder)
19 * hostorder = ntohs(netorder)
20 */
21LEAF(htons)
22ALEAF(ntohs)
23 srl v0, a0, 8
24 and v0, v0, 0xff
25 sll v1, a0, 8
26 and v1, v1, 0xff00
27 or v0, v0, v1
28 j ra
29END(htons)