make sure that VarIntLen can be inlined

This commit is contained in:
Marten Seemann
2019-08-20 14:18:50 +07:00
parent 2133d01956
commit f88546208d

View File

@@ -97,5 +97,10 @@ func VarIntLen(i uint64) protocol.ByteCount {
if i <= maxVarInt8 { if i <= maxVarInt8 {
return 8 return 8
} }
panic(fmt.Sprintf("%#x doesn't fit into 62 bits", i)) // Don't use a fmt.Sprintf here to format the error message.
// The function would then exceed the inlining budget.
panic(struct {
message string
num uint64
}{"value doesn't fit into 62 bits: ", i})
} }