shithub: scc

ref: 7e4b96f8949a4dc2e1da9a003b148ab0973123b0
dir: /src/libc/arch/amd64/memmove.s/

View raw version
	.file 	"memmove.s"

	.text
	.globl	memmove,_memmove
_memmove:
memmove:
	movq	%rdi,%rax

	movq	%rdx,%rcx

	cmpq	%rdi,%rsi
	jg	forward
	jl	backward
	ret

forward:
	cld
	rep
	movsb
	ret

backward:
	std
	movq	%rdx,%r8
	subq	$1,%r8
	addq	%r8,%rdi
	addq	%r8,%rsi
	rep;	movsb
	ret