Commit ef01ebf4 authored by Russ Cox's avatar Russ Cox

net: sync CIDRMask code, doc

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4961069
parent aed2c06d
......@@ -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
......
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