]> Cypherpunks repositories - gostls13.git/commitdiff
encoding/binary: ReadVarint reads a signed number, not unsigned number
authorShenghou Ma <minux.ma@gmail.com>
Fri, 26 Oct 2012 13:14:34 +0000 (21:14 +0800)
committerShenghou Ma <minux.ma@gmail.com>
Fri, 26 Oct 2012 13:14:34 +0000 (21:14 +0800)
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6762051

src/pkg/encoding/binary/varint.go

index 719018b6033a83a657d599447f0b66a592e2c210..7035529f2791a104b058d8a8c0124a7d6dd19785 100644 (file)
@@ -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)