strfind: assure re-check is done on mismatch after initial match + add tests

This commit is contained in:
2025-07-28 17:29:03 +02:00
parent eb5398da8f
commit ca6027abcd
2 changed files with 64 additions and 0 deletions

View File

@@ -192,6 +192,17 @@ strfind:
.noMatch:
; not gonna figure out here if there was an existing match already. just XOR r10b,r10b and load original pointer to what[] to rsi
; EDIT: actually yes I am. strfind("gidgiddy", "giddy", 0); [gid]giddy<>[gid]dy is a match but then gid[g]iddy<>gid[d]y is not while it should check gid[g]iddy<>[g]iddy
test r10b, r10b
jz .continueLoop
mov rsi, r11
mov r9b, byte [rsi]
cmp byte [rdi], r9b
jne .itReallyWasNoMatchAfterAll
mov r8, rcx
inc rsi
jmp .continueLoop
.itReallyWasNoMatchAfterAll:
xor r10b, r10b
mov rsi, r11