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

import "fmt"

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

	return uint64(v), nil
}