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

Function opLshift

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

Source from the content-addressed store, hash-verified

239}
240
241func opLshift(vm *virtualMachine) error {
242 err := vm.applyCost(8)
243 if err != nil {
244 return err
245 }
246 y, err := vm.popInt64(true)
247 if err != nil {
248 return err
249 }
250 if y < 0 {
251 return ErrBadValue
252 }
253 x, err := vm.popInt64(true)
254 if err != nil {
255 return err
256 }
257 if x == 0 || y == 0 {
258 return vm.pushInt64(x, true)
259 }
260
261 res, ok := checked.LshiftInt64(x, y)
262 if !ok {
263 return ErrRange
264 }
265
266 return vm.pushInt64(res, true)
267}
268
269func opRshift(vm *virtualMachine) error {
270 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