This commit is contained in:
Steven Allen 2018-06-18 19:16:23 -07:00
parent 84fb105635
commit b68c4a264d
1 changed files with 2 additions and 2 deletions

View File

@ -3,8 +3,8 @@ package multiaddr
import (
"encoding/binary"
"fmt"
"strings"
"math/bits"
"strings"
)
// Protocol is a Multiaddr protocol description structure.
@ -170,7 +170,7 @@ func ProtocolsWithString(s string) ([]Protocol, error) {
// CodeToVarint converts an integer to a varint-encoded []byte
func CodeToVarint(num int) []byte {
buf := make([]byte, bits.Len(uint(num))/7 + 1)
buf := make([]byte, bits.Len(uint(num))/7+1)
n := binary.PutUvarint(buf, uint64(num))
return buf[:n]
}