| 25 | } |
| 26 | |
| 27 | bool AddInt63Overflow(int64_t a, int64_t b, int64_t &result) { |
| 28 | #if HAVE_DECL___BUILTIN_SADDLL_OVERFLOW |
| 29 | if (__builtin_saddll_overflow(a, b, (long long int *)&result)) { |
| 30 | return true; |
| 31 | } |
| 32 | return result == std::numeric_limits<int64_t>::min(); |
| 33 | #else |
| 34 | return AddInt63OverflowEmulated(a, b, result); |
| 35 | #endif |
| 36 | } |
| 37 | |
| 38 | bool SubInt63OverflowEmulated(int64_t a, int64_t b, int64_t &result) { |
| 39 | if (a < 0 && b > std::numeric_limits<int64_t>::max() + a) { |