7 ms·
I wonder how often it'd be possible to deduce that an overflow is not possible from the context. (For example, if we've just checked that INT_MAX/a > b before d
by robryk 12y ago
I wonder how often it'd be possible to deduce that an overflow is not possible from the context. (For example, if we've just checked that INT_MAX/a > b before doing a*b.)
- stormbrew 12y agoThat's probably more expensive than a jno instruction after the possibly overflowing operation.
- DasIch 12y agoDivision is a lot more expensive than the multiplication itself, checking the overflow flag after the multiplication - which OP critizes for being too slow - is going to be much faster than your check.