safeSum returns the sum of x and y. or an error if the result overflows
(x, y uint32)
| 143 | |
| 144 | // safeSum returns the sum of x and y. or an error if the result overflows |
| 145 | func safeSum(x, y uint32) (uint32, error) { |
| 146 | z := x + y |
| 147 | if z < x || z < y { |
| 148 | return invalidID, errors.New("ID overflow") |
| 149 | } |
| 150 | return z, nil |
| 151 | } |
| 152 | |
| 153 | // serializeLinuxIDMapping marshals a LinuxIDMapping object to string |
| 154 | func serializeLinuxIDMapping(m specs.LinuxIDMapping) string { |
no outgoing calls
no test coverage detected
searching dependent graphs…