The idea is to use the instruction SBB(sub with loan). For example, if I have two numbers:
then this will put the difference in edx:eax:
sub eax, ebx
sbb edx, ecx
The idea is that you can subtract each part separately, but you need to borrow from the MSB for the lower digits. SBBdoes just that:
SBB dest, src means:
dest <-- dest - src - EFLAGS.CF
This is convenient because:
SUB dest, src means:
dest <-- dest - src
EFLAGS.CF <-- borrow from subtraction
source
share