vm: make IntToBytes, BytesToInt public
VM serialization format should be able to be reused.
This commit is contained in:
parent
9037cabe1e
commit
f15ceff592
6 changed files with 16 additions and 16 deletions
|
@ -48,7 +48,7 @@ func serializeItemTo(item StackItem, w *io.BinWriter, seen map[StackItem]bool) {
|
|||
w.WriteBool(t.value)
|
||||
case *BigIntegerItem:
|
||||
w.WriteBytes([]byte{byte(integerT)})
|
||||
w.WriteVarBytes(intToBytes(t.value))
|
||||
w.WriteVarBytes(IntToBytes(t.value))
|
||||
case *InteropItem:
|
||||
w.Err = errors.New("not supported")
|
||||
case *ArrayItem, *StructItem:
|
||||
|
@ -106,7 +106,7 @@ func DecodeBinaryStackItem(r *io.BinReader) StackItem {
|
|||
return NewBoolItem(b)
|
||||
case integerT:
|
||||
data := r.ReadVarBytes()
|
||||
num := bytesToInt(data)
|
||||
num := BytesToInt(data)
|
||||
return &BigIntegerItem{
|
||||
value: num,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue