diff options
| author | Thordur Bjornsson <thorduri@secnorth.net> | 2016-11-12 17:05:17 +0100 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2016-11-13 17:53:22 +0000 |
| commit | afa68b36cc225075e87b53e2f9c2edc9dfb73b9e (patch) | |
| tree | 88cd23d2da8edce25fba2386ce9288e0434a61b0 /src/encoding | |
| parent | 582a421a8c245268f7c081fa1191374d50a601f7 (diff) | |
| download | go-afa68b36cc225075e87b53e2f9c2edc9dfb73b9e.tar.xz | |
encoding/hex: Document DecodedLen.
Mention that it specifically returns x / 2, and do the same for
EncodedLen.
Change-Id: Ie334f5abecbc487caf4965abbcd14442591bef2a
Change-Id: Idfa413faad487e534489428451bf736b009293d6
Reviewed-on: https://go-review.googlesource.com/33191
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/encoding')
| -rw-r--r-- | src/encoding/hex/hex.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/encoding/hex/hex.go b/src/encoding/hex/hex.go index 8c2334871d..b43c1c4b45 100644 --- a/src/encoding/hex/hex.go +++ b/src/encoding/hex/hex.go @@ -18,6 +18,7 @@ var hextable = [16]byte{ } // EncodedLen returns the length of an encoding of n source bytes. +// Specifically, it returns n * 2. func EncodedLen(n int) int { return n * 2 } // Encode encodes src into EncodedLen(len(src)) @@ -43,6 +44,8 @@ func (e InvalidByteError) Error() string { return fmt.Sprintf("encoding/hex: invalid byte: %#U", rune(e)) } +// DecodedLen returns the length of a decoding of x source bytes. +// Specifically, it returns x / 2. func DecodedLen(x int) int { return x / 2 } // Decode decodes src into DecodedLen(len(src)) bytes, |
