Commit 2c2c2022 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

encoding/binary: document that PutVarint, PutUvarint may panic

Fixes #2628

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5571058
parent fe30ed2d
......@@ -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 {
......
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