Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
mf
go-multiaddr
Commits
1a8ba091
Commit
1a8ba091
authored
Nov 29, 2018
by
Cole Brown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug in VarintSize
:100644 100644 79ebe2f b0ced77 M varint.go
parent
ec8630b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
varint.go
varint.go
+7
-1
No files found.
varint.go
View file @
1a8ba091
...
...
@@ -8,7 +8,13 @@ import (
// VarintSize returns the size (in bytes) of `num` encoded as a varint.
func
VarintSize
(
num
int
)
int
{
return
bits
.
Len
(
uint
(
num
))
/
7
+
1
bits
:=
bits
.
Len
(
uint
(
num
))
q
,
r
:=
bits
/
7
,
bits
%
7
size
:=
q
if
r
>
0
{
size
++
}
return
size
}
// CodeToVarint converts an integer to a varint-encoded []byte
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment