ref: 040b572d95e4ca27e1ada6113c405b8a1eb4a669
dir: /internal/intconv/u64_i.go/
package intconv
import (
"fmt"
"math"
)
// Uint64ToInt converts v to int, returning an error if it overflows.
func Uint64ToInt(v uint64) (int, error) {
if v > uint64(math.MaxInt) {
return 0, fmt.Errorf("intconv: uint64 %d overflows int", v)
}
return int(v), nil
}