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

Function opDiv

protocol/vm/numeric.go:187–208  ·  view source on GitHub ↗
(vm *virtualMachine)

Source from the content-addressed store, hash-verified

185}
186
187func opDiv(vm *virtualMachine) error {
188 err := vm.applyCost(8)
189 if err != nil {
190 return err
191 }
192 y, err := vm.popInt64(true)
193 if err != nil {
194 return err
195 }
196 x, err := vm.popInt64(true)
197 if err != nil {
198 return err
199 }
200 if y == 0 {
201 return ErrDivZero
202 }
203 res, ok := checked.DivInt64(x, y)
204 if !ok {
205 return ErrRange
206 }
207 return vm.pushInt64(res, true)
208}
209
210func opMod(vm *virtualMachine) error {
211 err := vm.applyCost(8)

Callers

nothing calls this directly

Calls 3

applyCostMethod · 0.80
popInt64Method · 0.80
pushInt64Method · 0.80

Tested by

no test coverage detected