aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-09-07 15:50:07 -0400
committerRuss Cox <rsc@golang.org>2011-09-07 15:50:07 -0400
commitef01ebf4035063442d93ab4aadd0b56dc8ef05b8 (patch)
tree0f9af63b9eb1a7a9705e8e99139622efbf9c4c95
parentaed2c06dcbc21a305fb96418a97fcd935e27272d (diff)
downloadgo-ef01ebf4035063442d93ab4aadd0b56dc8ef05b8.tar.gz
go-ef01ebf4035063442d93ab4aadd0b56dc8ef05b8.zip
net: sync CIDRMask code, doc
R=golang-dev, r CC=golang-dev https://golang.org/cl/4961069
-rw-r--r--src/pkg/net/ip.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/pkg/net/ip.go b/src/pkg/net/ip.go
index 0ad27faebb..61dc3be909 100644
--- a/src/pkg/net/ip.go
+++ b/src/pkg/net/ip.go
@@ -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