SubInt32 returns a - b with an integer overflow check.
(a, b int32)
| 105 | // SubInt32 returns a - b |
| 106 | // with an integer overflow check. |
| 107 | func SubInt32(a, b int32) (diff int32, ok bool) { |
| 108 | if (b > 0 && a < math.MinInt32+b) || |
| 109 | (b < 0 && a > math.MaxInt32+b) { |
| 110 | return 0, false |
| 111 | } |
| 112 | return a - b, true |
| 113 | } |
| 114 | |
| 115 | // MulInt32 returns a * b |
| 116 | // with an integer overflow check. |
nothing calls this directly
no outgoing calls
no test coverage detected