MCPcopy Index your code
hub / github.com/chain/Core / doNumCompare

Function doNumCompare

protocol/vm/numeric.go:372–401  ·  view source on GitHub ↗
(vm *virtualMachine, op int)

Source from the content-addressed store, hash-verified

370}
371
372func doNumCompare(vm *virtualMachine, op int) error {
373 err := vm.applyCost(2)
374 if err != nil {
375 return err
376 }
377 y, err := vm.popInt64(true)
378 if err != nil {
379 return err
380 }
381 x, err := vm.popInt64(true)
382 if err != nil {
383 return err
384 }
385 var res bool
386 switch op {
387 case cmpLess:
388 res = x < y
389 case cmpLessEqual:
390 res = x <= y
391 case cmpGreater:
392 res = x > y
393 case cmpGreaterEqual:
394 res = x >= y
395 case cmpEqual:
396 res = x == y
397 case cmpNotEqual:
398 res = x != y
399 }
400 return vm.pushBool(res, true)
401}
402
403func opMin(vm *virtualMachine) error {
404 err := vm.applyCost(2)

Callers 6

opNumEqualFunction · 0.85
opNumNotEqualFunction · 0.85
opLessThanFunction · 0.85
opGreaterThanFunction · 0.85
opLessThanOrEqualFunction · 0.85
opGreaterThanOrEqualFunction · 0.85

Calls 3

applyCostMethod · 0.80
popInt64Method · 0.80
pushBoolMethod · 0.80

Tested by

no test coverage detected