mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-25 13:47:19 +00:00
io: improve GetVarSize() documentation
This commit is contained in:
parent
6dd37dd076
commit
d01b7740e2
1 changed files with 4 additions and 3 deletions
|
@ -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<T>(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<T>(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() {
|
||||
|
|
Loading…
Reference in a new issue