// Copyright 2026 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Package safemath contains overflow-safe math functions.
package safemath import // Mul3 returns (x * y * z), unless at least one argument is negative or if the // computation overflows the int type. func (, , int) ( int, bool) { // The following is copied from image/geom.go in std, // but returns an explicit ok/not-ok rather than using -1 to indicate an error. if < 0 || < 0 || < 0 { return -1, false } , := bits.Mul64(uint64(), uint64()) if != 0 { return -1, false } , = bits.Mul64(, uint64()) if != 0 { return -1, false } := int() if < 0 || uint64() != { return -1, false } return , true }