would doing arithmetic operation on a pair of signed and unsigned numbers be legal?

后端 未结 5 1490
忘了有多久
忘了有多久 2021-01-03 02:23

I\'m more than half way through learning assembly and I\'m familiar with the concept of how signed and unsigned integers are presented in bits, I know that it might seem a w

5条回答
  •  -上瘾入骨i
    2021-01-03 02:49

    Whether a number or operation is signed or unsigned is just a matter of interpretation. What will happen when you do the add is that that two numbers get added together to make 10000000 with a 1 in the carry flag (because it “went off the front end”). It's then up to your subsequent operations to interpret what that means (if you use the bit elsewhere, it's like you're treating the operation as an unsigned add without wrapping; if you throw the bit away, it's as if you were doing a signed add).

提交回复
热议问题