vm: move IntToBytes and BytesToInt to emit package

This commit is contained in:
Evgenii Stratonikov 2020-02-03 18:05:13 +03:00
parent 4d8a3a359b
commit c821e1c4c8
6 changed files with 15 additions and 7 deletions

View file

@ -3,6 +3,8 @@ package vm
import (
"errors"
"github.com/CityOfZion/neo-go/pkg/vm/emit"
"github.com/CityOfZion/neo-go/pkg/io"
)
@ -48,7 +50,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(emit.IntToBytes(t.value))
case *InteropItem:
w.Err = errors.New("not supported")
case *ArrayItem, *StructItem:
@ -106,7 +108,7 @@ func DecodeBinaryStackItem(r *io.BinReader) StackItem {
return NewBoolItem(b)
case integerT:
data := r.ReadVarBytes()
num := BytesToInt(data)
num := emit.BytesToInt(data)
return &BigIntegerItem{
value: num,
}