forked from TrueCloudLab/frostfs-api-go
Add stable marshaler for enums
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
f8482381fd
commit
a7a8fc33bb
4 changed files with 163 additions and 17 deletions
|
@ -120,6 +120,14 @@ func Int32Size(field int, v int32) int {
|
|||
return UInt64Size(field, uint64(v))
|
||||
}
|
||||
|
||||
func EnumMarshal(field int, buf []byte, v int32) (int, error) {
|
||||
return UInt64Marshal(field, buf, uint64(v))
|
||||
}
|
||||
|
||||
func EnumSize(field int, v int32) int {
|
||||
return UInt64Size(field, uint64(v))
|
||||
}
|
||||
|
||||
// varUIntSize returns length of varint byte sequence for uint64 value 'x'.
|
||||
func VarUIntSize(x uint64) int {
|
||||
return (bits.Len64(x|1) + 6) / 7
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue