mov eax, ptr_to_num1 ; little endian
mov ebx, ptr_to_num2 ; little endian
xor ecx, ecx
xor edx, edx
clc
bytes_addition:
mov dl, byte [eax+ecx] ; byte from shortest
adc dl, byte [ebx+ecx]
mov byte [eax+ecx], dl
inc ecx
cmp ecx, 4 ; counter,
jl bytes_addition
Consider in
EAX: 4F2252FF (large end)
EBX: 00DFFC00 (big end)
The result of this addition is incorrect: 50024fff (big endian). It should be 50024eff. It seems that the carry flag is affected, but why?
source
share