]> Cypherpunks repositories - gostls13.git/commitdiff
encoding/hex: Document DecodedLen.
authorThordur Bjornsson <thorduri@secnorth.net>
Sat, 12 Nov 2016 16:05:17 +0000 (17:05 +0100)
committerBrad Fitzpatrick <bradfitz@golang.org>
Sun, 13 Nov 2016 17:53:22 +0000 (17:53 +0000)
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>
src/encoding/hex/hex.go

index 8c2334871d8b69070297e8f5cefb4f5c7be22ff9..b43c1c4b4563c706c04c308ac7a489fc6c80df61 100644 (file)
@@ -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,