github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/runtime/internal/math/math.go (about) 1 // Copyright 2018 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package math 6 7 const MaxUintptr = ^uintptr(0) 8 9 // MulUintptr returns a * b and whether the multiplication overflowed. 10 // On supported platforms this is an intrinsic lowered by the compiler. 11 func MulUintptr(a, b uintptr) (uintptr, bool) 12 13 // Mul64 returns the 128-bit product of x and y: (hi, lo) = x * y 14 // with the product bits' upper half returned in hi and the lower 15 // half returned in lo. 16 // This is a copy from math/bits.Mul64 17 // On supported platforms this is an intrinsic lowered by the compiler. 18 func Mul64(x, y uint64) (hi, lo uint64) 19 20 // Add64 returns the sum with carry of x, y and carry: sum = x + y + carry. 21 // The carry input must be 0 or 1; otherwise the behavior is undefined. 22 // The carryOut output is guaranteed to be 0 or 1. 23 // 24 // This function's execution time does not depend on the inputs. 25 // On supported platforms this is an intrinsic lowered by the compiler. 26 func Add64(x, y, carry uint64) (sum, carryOut uint64)