I am analyzing a sequence of x86
instructions, and become confused with the following code:
135328495: sbb edx, edx
135328497: neg edx
135328499: test edx, edx
135328503: jz 0x810f31c
I understand that sbb
equals to des = des - (src + CF)
, in other words, the first instruction somehow put -CF
into edx
. Then it negtive
-CF
into CF
, and test
whether CF
equals to zero??
But note that jz
checks flag ZF
, not CF
! So basically what is the above code sequence trying to do? This is a legal x86
instruction sequence, produced by g++
version 4.6.3
.
sbb