LshiftInt32 returns a << b with an integer overflow check.
(a, b int32)
| 154 | // LshiftInt32 returns a << b |
| 155 | // with an integer overflow check. |
| 156 | func LshiftInt32(a, b int32) (result int32, ok bool) { |
| 157 | if b < 0 || b >= 32 { |
| 158 | return 0, false |
| 159 | } |
| 160 | if (a >= 0 && a > math.MaxInt32>>uint(b)) || (a < 0 && a < math.MinInt32>>uint(b)) { |
| 161 | return 0, false |
| 162 | } |
| 163 | return a << uint(b), true |
| 164 | } |
| 165 | |
| 166 | // AddUint64 returns a + b |
| 167 | // with an integer overflow check. |
nothing calls this directly
no outgoing calls
no test coverage detected