| 450 | */ |
| 451 | |
| 452 | static int increment_overflow(int *const ip, int j) { |
| 453 | int const i = *ip; |
| 454 | |
| 455 | /* |
| 456 | ** If i >= 0 there can only be overflow if i + j > INT_MAX |
| 457 | ** or if j > INT_MAX - i; given i >= 0, INT_MAX - i cannot overflow. |
| 458 | ** If i < 0 there can only be overflow if i + j < INT_MIN |
| 459 | ** or if j < INT_MIN - i; given i < 0, INT_MIN - i cannot overflow. |
| 460 | */ |
| 461 | if ((i >= 0) ? (j > INT_MAX - i) : (j < INT_MIN - i)) |
| 462 | return TRUE; // #nocov |
| 463 | *ip += j; |
| 464 | return FALSE; |
| 465 | } |
| 466 | |
| 467 | static int increment_overflow_time(time_t *tp, int_fast32_t j) { // #nocov start |
| 468 | /* |