forked from TrueCloudLab/neoneo-go
stackitem: serialize integers to the pre-allocated slice
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
291a29af1e
commit
f02d8b4ec4
1 changed files with 5 additions and 2 deletions
|
@ -112,8 +112,11 @@ func (w *serContext) serialize(item Item) error {
|
|||
}
|
||||
case *BigInteger:
|
||||
w.data = append(w.data, byte(IntegerT))
|
||||
data := bigint.ToBytes(t.Value().(*big.Int))
|
||||
w.appendVarUint(uint64(len(data)))
|
||||
v := t.Value().(*big.Int)
|
||||
ln := len(w.data)
|
||||
w.data = append(w.data, 0)
|
||||
data := bigint.ToPreallocatedBytes(v, w.data[len(w.data):])
|
||||
w.data[ln] = byte(len(data))
|
||||
w.data = append(w.data, data...)
|
||||
case *Interop:
|
||||
if w.allowInvalid {
|
||||
|
|
Loading…
Reference in a new issue