Package math

import "internal/runtime/math"
Overview
Index

Overview ▾

Constants

const (
    MaxUint16  = ^uint16(0)
    MaxUint32  = ^uint32(0)
    MaxUint64  = ^uint64(0)
    MaxUintptr = ^uintptr(0)

    MaxInt64 = int64(MaxUint64 >> 1)
)

func Add64

func Add64(x, y, carry uint64) (sum, carryOut uint64)

Add64 returns the sum with carry of x, y and carry: sum = x + y + carry. The carry input must be 0 or 1; otherwise the behavior is undefined. The carryOut output is guaranteed to be 0 or 1.

This function's execution time does not depend on the inputs. On supported platforms this is an intrinsic lowered by the compiler.

func MulUintptr

func MulUintptr(a, b uintptr) (uintptr, bool)

MulUintptr returns a * b and whether the multiplication overflowed. On supported platforms this is an intrinsic lowered by the compiler.