Add mem.compare, mem.copy, mem.fill32, unsafe_mem.compare #13

Merged
ShatteredMINT merged 9 commits from Mutex/symphony_stdlib:mem_ops into main 2026-09-04 21:55:24 +02:00
Showing only changes of commit 655ce0237e - Show all commits
+4 -2
View File
@@ -12,6 +12,8 @@
; - `<0` if the first segment is less than the second segment.
; - `>0` if the first segment is greater than the second segment.
pub compare:
cmp r1, r2
je _compare__is_eq
; Exclusive end point of the second segment.
add r4, r3, r2
; Exclusive end point of the first segment.
@@ -62,7 +64,7 @@ _compare__low1:
; Otherwise, the target is that non-zero byte.
; Check if the target is out of bounds, i.e. the loop terminated through the "bounds check".
cmp r1, r3
jae _compare__oob
jae _compare__is_eq
; r5 is the comparison result in the format of `cmp`. Convert it to the desired format.
; 00 => 0x40000000 > 0
; 01 => 0x00000000 = 0
@@ -70,6 +72,6 @@ _compare__low1:
xor r1, r5, 1
lsl r1, r1, 30
jmp r13
_compare__oob:
_compare__is_eq:
mov r1, 0
jmp r13