From d01b7740e2de1e7afece5b901d2c16cba724a8ef Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 20 Sep 2019 19:10:13 +0300 Subject: [PATCH] io: improve GetVarSize() documentation --- pkg/io/size.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/io/size.go b/pkg/io/size.go index 594d6bb0a..7b062f6a4 100644 --- a/pkg/io/size.go +++ b/pkg/io/size.go @@ -53,9 +53,10 @@ func getVarStringSize(value string) int { return getVarIntSize(valueSize) + valueSize } -// GetVarSize return the size om bytes of a variable. This implementation is not exactly like the C# -// (reference: GetVarSize(this T[] value), https://github.com/neo-project/neo/blob/master/neo/IO/Helper.cs#L53) as in the C# variable -// like Uint160, Uint256 are not supported. +// GetVarSize returns the number of bytes in a serialized variable. It supports ints/uints (estimating +// them using variable-length encoding that is used in NEO), strings, pointers to Serializable structures, +// slices and arrays of ints/uints or Serializable structures. It's similar to GetVarSize(this T[] value) +// used in C#, but differs in that it also supports things like Uint160 or Uint256. func GetVarSize(value interface{}) int { v := reflect.ValueOf(value) switch v.Kind() {