Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
og-rek
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
og-rek
Commits
d1fee502
Commit
d1fee502
authored
Nov 24, 2013
by
Damian Gryski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
encoder: fix integer encoding ranges
parent
c1da7072
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
encode.go
encode.go
+6
-3
No files found.
encode.go
View file @
d1fee502
...
...
@@ -132,13 +132,16 @@ func (e *Encoder) encodeInt(k reflect.Kind, i int64) {
// FIXME: need support for 64-bit ints
switch
{
case
i
>
0
&&
i
<
math
.
Max
I
nt8
:
case
i
>
0
&&
i
<
math
.
Max
Ui
nt8
:
e
.
w
.
Write
([]
byte
{
opBinint1
,
byte
(
i
)})
case
i
>
0
&&
i
<
math
.
Max
I
nt16
:
case
i
>
0
&&
i
<
math
.
Max
Ui
nt16
:
e
.
w
.
Write
([]
byte
{
opBinint2
,
byte
(
i
>>
8
),
byte
(
i
)})
default
:
case
i
>=
math
.
MinInt32
&&
i
<=
math
.
MaxInt32
:
e
.
w
.
Write
([]
byte
{
opBinint
})
binary
.
Write
(
e
.
w
,
binary
.
LittleEndian
,
int32
(
i
))
default
:
// int64, but as a string :/
e
.
w
.
Write
([]
byte
{
opInt
})
fmt
.
Fprintf
(
e
.
w
,
"%d
\n
"
,
i
)
}
}
...
...
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