Commit f9902c71 authored by Shenghou Ma's avatar Shenghou Ma

encoding/binary: ReadVarint reads a signed number, not unsigned number

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6762051
parent 067315c6
...@@ -123,7 +123,7 @@ func ReadUvarint(r io.ByteReader) (uint64, error) { ...@@ -123,7 +123,7 @@ func ReadUvarint(r io.ByteReader) (uint64, error) {
panic("unreachable") panic("unreachable")
} }
// ReadVarint reads an encoded unsigned integer from r and returns it as an int64. // ReadVarint reads an encoded signed integer from r and returns it as an int64.
func ReadVarint(r io.ByteReader) (int64, error) { func ReadVarint(r io.ByteReader) (int64, error) {
ux, err := ReadUvarint(r) // ok to continue in presence of error ux, err := ReadUvarint(r) // ok to continue in presence of error
x := int64(ux >> 1) x := int64(ux >> 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment