summaryrefslogtreecommitdiff
path: root/sys/lib/libkern/arch/mips/htons.S
blob: 2ac256aa271823842330a6b99ff6b604afd7d52f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "DEFS.h"

	.set	noreorder

/*
 * netorder = htons(hostorder)
 * hostorder = ntohs(netorder)
 */
LEAF(htons)
ALEAF(ntohs)
	srl	v0, a0, 8
	and	v0, v0, 0xff
	sll	v1, a0, 8
	and	v1, v1, 0xff00
	j	ra
	 or	v0, v0, v1
END(htons)