From f9902c7197f436578e8fafa7946d8cd83467729e Mon Sep 17 00:00:00 2001 From: Shenghou Ma Date: Fri, 26 Oct 2012 21:14:34 +0800 Subject: [PATCH] encoding/binary: ReadVarint reads a signed number, not unsigned number R=golang-dev, iant CC=golang-dev https://golang.org/cl/6762051 --- src/pkg/encoding/binary/varint.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pkg/encoding/binary/varint.go b/src/pkg/encoding/binary/varint.go index 719018b603..7035529f27 100644 --- a/src/pkg/encoding/binary/varint.go +++ b/src/pkg/encoding/binary/varint.go @@ -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)