computes x + y returns to true if x+y overflowed
| 10 | // computes x + y |
| 11 | // returns to true if x+y overflowed |
| 12 | bool safe_add |
| 13 | ( |
| 14 | int x, // x |
| 15 | int y, // y |
| 16 | int *z // x+y |
| 17 | ) { |
| 18 | ASSERT(z != NULL); |
| 19 | return __builtin_add_overflow(x, y, z); |
| 20 | } |
| 21 | |
| 22 | // computes x * y |
| 23 | // returns to true if x*y overflowed |