(x, y uint64, rest ...uint64)
| 104 | } |
| 105 | |
| 106 | func safeAdd(x, y uint64, rest ...uint64) uint64 { |
| 107 | if y > 0 && x > math.MaxUint64-y { |
| 108 | return math.MaxUint64 |
| 109 | } |
| 110 | next := x + y |
| 111 | if len(rest) == 0 { |
| 112 | return next |
| 113 | } |
| 114 | return safeAdd(next, rest[0], rest[1:]...) |
| 115 | } |
| 116 | |
| 117 | func safeMul(x, y uint64) uint64 { |
| 118 | if y != 0 && x > math.MaxUint64/y { |
no outgoing calls
no test coverage detected