mustParseInt parses the given expression as an int or returns an error.
(expr string)
| 329 | |
| 330 | // mustParseInt parses the given expression as an int or returns an error. |
| 331 | func mustParseInt(expr string) (uint, error) { |
| 332 | num, err := strconv.Atoi(expr) |
| 333 | if err != nil { |
| 334 | return 0, fmt.Errorf("failed to parse int from %s: %s", expr, err) |
| 335 | } |
| 336 | if num < 0 { |
| 337 | return 0, fmt.Errorf("negative number (%d) not allowed: %s", num, expr) |
| 338 | } |
| 339 | |
| 340 | return uint(num), nil |
| 341 | } |
| 342 | |
| 343 | // getBits sets all bits in the range [min, max], modulo the given step size. |
| 344 | func getBits(min, max, step uint) uint64 { |
no outgoing calls
no test coverage detected