LshiftInt64 returns a << b with an integer overflow check.
(a, b int64)
| 74 | // LshiftInt64 returns a << b |
| 75 | // with an integer overflow check. |
| 76 | func LshiftInt64(a, b int64) (result int64, ok bool) { |
| 77 | if b < 0 || b >= 64 { |
| 78 | return 0, false |
| 79 | } |
| 80 | if (a >= 0 && a > math.MaxInt64>>uint(b)) || (a < 0 && a < math.MinInt64>>uint(b)) { |
| 81 | return 0, false |
| 82 | } |
| 83 | return a << uint(b), true |
| 84 | } |
| 85 | |
| 86 | // RshiftInt64 returns a >> b |
| 87 | // with an integer overflow check. |
nothing calls this directly
no outgoing calls
no test coverage detected