Files
nub-lang/src/runtime/baseline/nub_strcmp.s
nub31 fb391c9fb2 ,,,
2025-06-10 18:40:35 +02:00

25 lines
446 B
ArmAsm

.intel_syntax noprefix
.section .text
# String comparison function null-terminated strings
# Arguments: rdi = lhs (*char), rsi = rhs (*char)
# Returns: 1 if equal, else 0
.globl nub_strcmp
nub_strcmp:
xor rdx, rdx
.loop:
mov al, BYTE PTR [rsi + rdx]
mov bl, BYTE PTR [rdi + rdx]
inc rdx
cmp al, bl
jne .not_equal
cmp al, 0
je .equal
jmp .loop
.not_equal:
mov rax, 0
ret
.equal:
mov rax, 1
ret