added neg and bitnot to the stdlib and made a fib.sl example

This commit is contained in:
IgorCielniak
2025-12-25 12:20:11 +01:00
parent 2b8cd25499
commit e2b1368899
2 changed files with 32 additions and 0 deletions

View File

@@ -413,3 +413,19 @@
mov [r12], rax ; push value
}
;
# : neg ( x -- -x )
:asm neg {
mov rax, [r12] ; get value
neg rax ; arithmetic negation
mov [r12], rax ; store result
}
;
# : bitnot ( 0|1 -- 1|0 )
:asm bitnot {
mov rax, [r12] ; get value
xor rax, 1 ; flip lowest bit
mov [r12], rax ; store result
}
;