Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

v1 source pure

Package safemath is checked, non-negative int64 arithmetic for launchpad amounts.

Overview

Package safemath is checked, non-negative int64 arithmetic for launchpad amounts.

Constants 1

Functions 7

func Add

1func Add(a, b int64) int64
source

func BPS

1func BPS(amount, bps int64) int64
source

BPS returns floor(amount*bps/10000) for 0 <= bps <= 10000.

func Min

1func Min(a, b int64) int64
source

func Mul

1func Mul(a, b int64) int64
source

func MulDiv

1func MulDiv(a, b, d int64) int64
source

MulDiv returns floor(a*b/d) using a 128-bit intermediate.

func MulDivUp

1func MulDivUp(a, b, d int64) int64
source

MulDivUp returns ceil(a*b/d) using a 128-bit intermediate.

func Sub

1func Sub(a, b int64) int64
source

Imports 1

  • math/bits stdlib

Source Files 2