frostfs-contract/tests/testdata/encode.go
Evgenii Stratonikov 2be81b1def [#42] common: Add routines for fixed-width uint64 marshaling
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-10-24 13:28:10 +03:00

17 lines
414 B
Go

package testdata
import (
"git.frostfs.info/TrueCloudLab/frostfs-contract/common"
)
// EncodeDecode encodes x in fixed-width little-endian representation
// and deserializes it back.
func EncodeDecode(x int) int {
y := common.ToFixedWidth64(x)
return common.FromFixedWidth64(y)
}
// Encode encodes x in fixed-width little-endian representation.
func Encode(x int) []byte {
return common.ToFixedWidth64(x)
}