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:
|
case *BigInteger:
|
||||||
w.data = append(w.data, byte(IntegerT))
|
w.data = append(w.data, byte(IntegerT))
|
||||||
data := bigint.ToBytes(t.Value().(*big.Int))
|
v := t.Value().(*big.Int)
|
||||||
w.appendVarUint(uint64(len(data)))
|
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...)
|
w.data = append(w.data, data...)
|
||||||
case *Interop:
|
case *Interop:
|
||||||
if w.allowInvalid {
|
if w.allowInvalid {
|
||||||
|
|
Loading…
Reference in a new issue