aboutsummaryrefslogtreecommitdiff
path: root/internal/intconv/i_u64.go
blob: a94a162c3e01b392be85e836d732fd8cf754345c (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
package intconv

import "fmt"

// IntToUint64 converts v to uint64, returning an error if v is negative.
func IntToUint64(v int) (uint64, error) {
	if v < 0 {
		return 0, fmt.Errorf("intconv: int %d is negative", v)
	}

	return uint64(v), nil
}