forked from TrueCloudLab/frostfs-api-go
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:
parent
65e5457a21
commit
f8e6908e50
1 changed files with 3 additions and 2 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue