summaryrefslogtreecommitdiff
path: root/sys/lib/libkern/arch/mips64/htons.S
blob: 644d2ef1c2a1b7b23dd544b316044ddca07567df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*	$OpenBSD: htons.S,v 1.1 2004/08/11 10:29:59 pefo Exp $	*/

#include "DEFS.h"


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