MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / safeSub

Function safeSub

blockproducer/metaindex.go:36–42  ·  view source on GitHub ↗

safeAdd provides a safe sub method with lower overflow check for uint64.

(x, y *uint64)

Source from the content-addressed store, hash-verified

34
35// safeAdd provides a safe sub method with lower overflow check for uint64.
36func safeSub(x, y *uint64) (err error) {
37 if *x < *y {
38 return ErrInsufficientBalance
39 }
40 *x -= *y
41 return
42}
43
44type metaIndex struct {
45 accounts map[proto.AccountAddress]*types.Account

Callers 2

decreaseAccountTokenMethod · 0.85
transferAccountTokenMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected