MCPcopy Create free account
hub / github.com/chain/txvm / bury

Method bury

protocol/txvm/stack.go:66–76  ·  view source on GitHub ↗
(n int64)

Source from the content-addressed store, hash-verified

64}
65
66func (s *stack) bury(n int64) error {
67 if n < 0 || n >= int64(len(*s)) {
68 return errors.Wrapf(errors.WithData(ErrStackRange, "len(stack)", len(*s)), "bury %d", n)
69 }
70 v := *s
71 item := v[len(v)-1]
72 i := int64(len(v)) - n - 1
73 copy(v[i+1:], v[i:len(v)-1])
74 v[i] = item
75 return nil
76}
77
78func (s *stack) Len() int {
79 return len(*s)

Callers 1

opBuryFunction · 0.80

Calls 2

WrapfFunction · 0.92
WithDataFunction · 0.92

Tested by

no test coverage detected