From f8e6908e50d5c61966c68b4228f19c9e3387e09f Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 17 Aug 2020 13:40:41 +0300 Subject: [PATCH] Update NestedStructurePrefix helper function Return prefix and it's length for optimizations in stable marshallers. Signed-off-by: Alex Vanin --- util/proto/marshal.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/util/proto/marshal.go b/util/proto/marshal.go index cc055a5..a975e32 100644 --- a/util/proto/marshal.go +++ b/util/proto/marshal.go @@ -292,6 +292,7 @@ func VarUIntSize(x uint64) int { return (bits.Len64(x|1) + 6) / 7 } -func NestedStructurePrefixSize(field int64) int { - return VarUIntSize(uint64(field<<3 | 0x02)) +func NestedStructurePrefix(field int64) (prefix uint64, ln int) { + prefix = uint64(field<<3 | 0x02) + return prefix, VarUIntSize(prefix) }