From 6981ff027df7dc2a6631bca2acd415332ab471ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Isalski?= Date: Mon, 31 Aug 2026 23:03:23 +0200 Subject: [PATCH] Tested and fixed stride->shift conversion missing --- array.asm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/array.asm b/array.asm index 3d06c91..c6e34d5 100644 --- a/array.asm +++ b/array.asm @@ -19,7 +19,8 @@ pub find_index: mov r11, r1 mov r10, r3 mov r9, r2 - lsl r9, r9, r3 ; We calculate bytes left + lsr r6, r3, 1 ; We turn the stride into a byte shift + lsl r9, r9, r6 ; We calculate bytes left add r9, r9, r1 ; We add the start address to get the final address push r13 ; We save up the return address because we will provide our own to the predicate @@ -42,11 +43,11 @@ pub find_index: load_32 r2, [sp] ; We load the predicate context into r2 jmp r12 ; We call the predicate cmp r1, zr - jneq find_index_found_item ; If we found the item, we jump out + jne find_index_found_item ; If we found the item, we jump out ; If we didn't, move to next item add r11, r11, r10 ; We add the stride to the pointer cmp r11, r9 ; We compare with the final address - jeq find_index_not_found ; If we reached the end we're done + je find_index_not_found ; If we reached the end we're done jmp find_index_loop find_index_not_found: @@ -71,4 +72,3 @@ pub find_index: pop r11 pop r12 jmp r13 ; Return -