MCPcopy Create free account
hub / github.com/DNAProject/DNA / Mod

Method Mod

vm/neovm/types/int_value.go:282–291  ·  view source on GitHub ↗

todo: check negative value with big.Int

(other IntValue)

Source from the content-addressed store, hash-verified

280
281// todo: check negative value with big.Int
282func (self IntValue) Mod(other IntValue) (IntValue, error) {
283 if other.IsZero() {
284 return IntValue{}, errors.ERR_DIV_MOD_BY_ZERO
285 }
286 return self.intOp(other, func(a, b int64) (int64, bool) {
287 return a % b, true
288 }, func(a, b *big.Int) (IntValue, error) {
289 return IntValFromBigInt(new(big.Int).Rem(a, b))
290 })
291}
292
293// todo: check negative value with big.Int
294func (self IntValue) Div(other IntValue) (IntValue, error) {

Callers 2

ExecuteOpMethod · 0.80
compareFuncIntValueFunction · 0.80

Calls 3

intOpMethod · 0.95
IntValFromBigIntFunction · 0.85
IsZeroMethod · 0.80

Tested by 1

compareFuncIntValueFunction · 0.64