]> Cypherpunks repositories - gostls13.git/commitdiff
net: sync CIDRMask code, doc
authorRuss Cox <rsc@golang.org>
Wed, 7 Sep 2011 19:50:07 +0000 (15:50 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 7 Sep 2011 19:50:07 +0000 (15:50 -0400)
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4961069

src/pkg/net/ip.go

index 0ad27faebb539d4ecd9f9098befa33e7f856fd91..61dc3be909ce23e48399ef529c6d207418aca1c0 100644 (file)
@@ -65,8 +65,9 @@ func IPv4Mask(a, b, c, d byte) IPMask {
        return p
 }
 
-// CIDRMask returns an IPMask of size bits with the first n bits
-// set to to 1. nil is returned if the mask is impossible.
+// CIDRMask returns an IPMask consisting of `ones' 1 bits
+// followed by 0s up to a total length of `bits' bits.
+// For a mask of this form, CIDRMask is the inverse of IPMask.Size.
 func CIDRMask(ones, bits int) IPMask {
        if bits != 8*IPv4len && bits != 8*IPv6len {
                return nil