0

imul and idiv works exactly the same like mul and div. So is it just a convention to use it with signed integers?

phuclv
  • 32,499
  • 12
  • 130
  • 417
  • 4
    No, they don't work the same for signed values, so you should indeed be using them if that's your scenario. – 500 - Internal Server Error Jan 05 '22 at 10:45
  • 3
    Note that what @500-InternalServerError says only applies to the one operand form of `imul` and `idiv`. The two and three operand forms of `imul` apply to signed and unsigned numbers equally. – fuz Jan 05 '22 at 11:04
  • `imul` and `mul` are not the same, and not only in signedness. See [this answer](https://stackoverflow.com/a/42589535/485343) for more details. – rustyx Jan 05 '22 at 11:15

0 Answers0