aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/encoding/binary/varint.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/encoding/binary/varint.go')
-rw-r--r--src/pkg/encoding/binary/varint.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/pkg/encoding/binary/varint.go b/src/pkg/encoding/binary/varint.go
index 6566ab0600..b756afdd04 100644
--- a/src/pkg/encoding/binary/varint.go
+++ b/src/pkg/encoding/binary/varint.go
@@ -37,6 +37,7 @@ const (
)
// PutUvarint encodes a uint64 into buf and returns the number of bytes written.
+// If the buffer is too small, PutUvarint will panic.
func PutUvarint(buf []byte, x uint64) int {
i := 0
for x >= 0x80 {
@@ -73,6 +74,7 @@ func Uvarint(buf []byte) (uint64, int) {
}
// PutVarint encodes an int64 into buf and returns the number of bytes written.
+// If the buffer is too small, PutVarint will panic.
func PutVarint(buf []byte, x int64) int {
ux := uint64(x) << 1
if x < 0 {