equal
deleted
inserted
replaced
446 /* res = a * b */ |
446 /* res = a * b */ |
447 static void CHECK_OVERFLOW_uint64_MUL(symbol_c *res, symbol_c *a, symbol_c *b) { |
447 static void CHECK_OVERFLOW_uint64_MUL(symbol_c *res, symbol_c *a, symbol_c *b) { |
448 if (!VALID_CVALUE(uint64, res)) |
448 if (!VALID_CVALUE(uint64, res)) |
449 return; |
449 return; |
450 /* Test by pre-condition: If (UINT64_MAX / a) < b => overflow! */ |
450 /* Test by pre-condition: If (UINT64_MAX / a) < b => overflow! */ |
|
451 if (0 == GET_CVALUE(uint64, a)) |
|
452 return; // multiplying by 0 will always result in 0, a valid result! |
451 if ((UINT64_MAX / GET_CVALUE(uint64, a)) < GET_CVALUE(uint64, b)) |
453 if ((UINT64_MAX / GET_CVALUE(uint64, a)) < GET_CVALUE(uint64, b)) |
452 SET_OVFLOW(uint64, res); |
454 SET_OVFLOW(uint64, res); |
453 } |
455 } |
454 |
456 |
455 |
457 |