ref: 27ef9a7e1f2589d1a0eeee4cd6d36d1926989cf2
dir: /internal/intconv/u64_i64.go/
package intconv
import (
"fmt"
"math"
)
// Uint64ToInt64 converts v to int64, returning an error if it overflows.
func Uint64ToInt64(v uint64) (int64, error) {
if v > math.MaxInt64 {
return 0, fmt.Errorf("intconv: uint64 %d overflows int64", v)
}
return int64(v), nil
}