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

Method Insert

vm/neovm/value_stack.go:48–61  ·  view source on GitHub ↗
(index int64, t types.VmValue)

Source from the content-addressed store, hash-verified

46}
47
48func (self *ValueStack) Insert(index int64, t types.VmValue) error {
49 l := int64(len(self.data))
50 if l >= self.limit {
51 return errors.ERR_OVER_LIMIT_STACK
52 }
53 if index > l || index < 0 {
54 return errors.ERR_INDEX_OUT_OF_BOUND
55 }
56 index = l - index
57 self.data = append(self.data, t)
58 copy(self.data[index+1:], self.data[index:])
59 self.data[index] = t
60 return nil
61}
62
63func (self *ValueStack) Peek(index int64) (value types.VmValue, err error) {
64 l := int64(len(self.data))

Callers 1

ExecuteOpMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected