Update NestedStructurePrefix helper function

Return prefix and it's length for optimizations in
stable marshallers.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-08-17 13:40:41 +03:00 committed by Stanislav Bogatyrev
parent 65e5457a21
commit f8e6908e50

View file

@ -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)
}