frostfs-contract/tests/testdata/encode.go
Evgenii Stratonikov 1ebeff7f6f [#42] common: Add routines for fixed-width uint64 marshaling
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-10-05 15:10:04 +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)
}