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

Method encode

protocol/txvm/item.go:57–66  ·  view source on GitHub ↗
(w *bytes.Buffer)

Source from the content-addressed store, hash-verified

55func (t Tuple) isDroppable() bool { return true }
56
57func (i Int) encode(w *bytes.Buffer) {
58 if op.IsSmallInt(int64(i)) {
59 w.WriteByte(op.MinSmallInt + byte(i))
60 return
61 }
62 var buf [binary.MaxVarintLen64]byte
63 n := binary.PutUvarint(buf[:], uint64(i))
64 writePushdata(w, buf[:n])
65 w.WriteByte(op.Int)
66}
67
68func (b Bytes) encode(w *bytes.Buffer) {
69 writePushdata(w, b)

Callers

nothing calls this directly

Calls 2

IsSmallIntFunction · 0.92
writePushdataFunction · 0.70

Tested by

no test coverage detected