LibC: Cleanup memmove and memcpy for x86_64

This commit is contained in:
Bananymous 2025-08-16 14:05:21 +03:00
parent b6793cc6f2
commit ceca93c8b1
1 changed files with 1 additions and 3 deletions

View File

@ -27,22 +27,20 @@ memcmp:
memcpy: memcpy:
movq %rdi, %rax movq %rdi, %rax
movq %rdx, %rcx movq %rdx, %rcx
movq %rdi, %rdx
rep movsb rep movsb
movq %rdx, %rax
ret ret
.global memmove .global memmove
memmove: memmove:
cmpq %rdi, %rsi cmpq %rdi, %rsi
jae memcpy jae memcpy
movq %rdi, %rax
leaq -1(%rdi, %rdx), %rdi leaq -1(%rdi, %rdx), %rdi
leaq -1(%rsi, %rdx), %rsi leaq -1(%rsi, %rdx), %rsi
movq %rdx, %rcx movq %rdx, %rcx
std std
rep movsb rep movsb
cld cld
leaq 1(%rdi), %rax
ret ret
.global memset .global memset