AddInt32 returns a + b with an integer overflow check.
(a, b int32)
| 95 | // AddInt32 returns a + b |
| 96 | // with an integer overflow check. |
| 97 | func AddInt32(a, b int32) (sum int32, ok bool) { |
| 98 | if (b > 0 && a > math.MaxInt32-b) || |
| 99 | (b < 0 && a < math.MinInt32-b) { |
| 100 | return 0, false |
| 101 | } |
| 102 | return a + b, true |
| 103 | } |
| 104 | |
| 105 | // SubInt32 returns a - b |
| 106 | // with an integer overflow check. |
nothing calls this directly
no outgoing calls
no test coverage detected