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

Function SubInt32

math/checked/checked.go:107–113  ·  view source on GitHub ↗

SubInt32 returns a - b with an integer overflow check.

(a, b int32)

Source from the content-addressed store, hash-verified

105// SubInt32 returns a - b
106// with an integer overflow check.
107func SubInt32(a, b int32) (diff int32, ok bool) {
108 if (b > 0 && a < math.MinInt32+b) ||
109 (b < 0 && a > math.MaxInt32+b) {
110 return 0, false
111 }
112 return a - b, true
113}
114
115// MulInt32 returns a * b
116// with an integer overflow check.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected