state: use more efficient encoding for amount

It's variable-length anyway, so wasting 8 bytes for what typically is 1 byte
makes no sense.
This commit is contained in:
Roman Khimov 2020-09-21 21:51:33 +03:00
parent 806b89db76
commit ff11a5f990
2 changed files with 11 additions and 10 deletions

View file

@ -6,8 +6,12 @@ import (
"math/bits"
)
// wordSizeBytes is a size of a big.Word (uint) in bytes.`
const wordSizeBytes = bits.UintSize / 8
const (
// MaxBytesLen is the maximum length of serialized integer suitable for Neo VM.
MaxBytesLen = 33 // 32 bytes for 256-bit integer plus 1 if padding needed
// wordSizeBytes is a size of a big.Word (uint) in bytes.`
wordSizeBytes = bits.UintSize / 8
)
// FromBytes converts data in little-endian format to
// an integer.