mirror of
https://github.com/golang/go
synced 2024-11-23 00:00:07 -07:00
encoding/binary: ReadVarint reads a signed number, not unsigned number
R=golang-dev, iant CC=golang-dev https://golang.org/cl/6762051
This commit is contained in:
parent
067315c647
commit
f9902c7197
@ -123,7 +123,7 @@ func ReadUvarint(r io.ByteReader) (uint64, error) {
|
||||
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) {
|
||||
ux, err := ReadUvarint(r) // ok to continue in presence of error
|
||||
x := int64(ux >> 1)
|
||||
|
Loading…
Reference in New Issue
Block a user