summaryrefslogtreecommitdiff
path: root/lib/libc/arch/m68k/string/swab.S
blob: 4a93118be9799ff467f90cd9f916a05420f8f574 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "DEFS.h"

#if defined(LIBC_SCCS)
	.text
	.asciz "$OpenBSD: swab.S,v 1.3 1996/08/19 08:15:29 tholo Exp $"
#endif /* LIBC_SCCS */

ENTRY(swab)
	movl	sp@(4),a0		| source
	movl	sp@(8),a1		| destination
	movl	sp@(12),d0		| count
	lsrl	#1,d0			| count is in bytes; we need words
	beq	swdone

swloop:
	movw	a0@+,d1
	rorw	#8,d1
	movw	d1,a1@+
	subql	#1,d0
	bne	swloop

swdone:
	rts