MCPcopy Create free account
hub / github.com/chain/txvm / AddInt64

Function AddInt64

math/checked/checked.go:17–23  ·  view source on GitHub ↗

AddInt64 returns a + b with an integer overflow check.

(a, b int64)

Source from the content-addressed store, hash-verified

15// AddInt64 returns a + b
16// with an integer overflow check.
17func AddInt64(a, b int64) (sum int64, ok bool) {
18 if (b > 0 && a > math.MaxInt64-b) ||
19 (b < 0 && a < math.MinInt64-b) {
20 return 0, false
21 }
22 return a + b, true
23}
24
25// SubInt64 returns a - b
26// with an integer overflow check.

Callers 6

AddTxMethod · 0.92
opMergeFunction · 0.92
chargeCreateMethod · 0.92
chargeCopyMethod · 0.92
opJumpIfFunction · 0.92
mergeFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected