Use defined MaxVarintLen64 from stdlib
This commit is contained in:
2
cid.go
2
cid.go
@@ -188,7 +188,7 @@ func (c *Cid) bytesV0() []byte {
|
||||
|
||||
func (c *Cid) bytesV1() []byte {
|
||||
// two 8 bytes (max) numbers plus hash
|
||||
buf := make([]byte, 2*8+len(c.hash))
|
||||
buf := make([]byte, 2*binary.MaxVarintLen64+len(c.hash))
|
||||
n := binary.PutUvarint(buf, c.version)
|
||||
n += binary.PutUvarint(buf[n:], c.codec)
|
||||
copy(buf[n:], c.hash)
|
||||
|
||||
Reference in New Issue
Block a user