can you please help me, I have this ams code:
; subs two long number
; rsi -- address of minuend (long number)
; rdi -- address of subtrahend (long number)
; rcx -- length of long numbers in qwords
; result:
; sub is written to rdi
sub_long_long:
push rdi
push rsi
push rcx
clc
.loop:
mov rax, [rsi]
lea rsi, [rsi + 8]
sbb rax, [rdi]
mov [rdi], rax
lea rdi, [rdi + 8]
dec rcx
jnz .loop
pop rcx
pop rsi
pop rdi
ret
now, if I'm change lea rsi, [rsi + 8]
to add rsi, 8
program give me wrong result on pretty big numbers, e.g.:
10000000000000000000000000000000000000000000000000000000000000000000 1000000000000000000000000000 9999999999999999999999999999999999999999000000018446744073709551616
Why is it happening?