mirror of
https://github.com/golang/go
synced 2024-11-22 05:04:40 -07:00
net: sync CIDRMask code, doc
R=golang-dev, r CC=golang-dev https://golang.org/cl/4961069
This commit is contained in:
parent
aed2c06dcb
commit
ef01ebf403
@ -65,8 +65,9 @@ func IPv4Mask(a, b, c, d byte) IPMask {
|
|||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
// CIDRMask returns an IPMask of size bits with the first n bits
|
// CIDRMask returns an IPMask consisting of `ones' 1 bits
|
||||||
// set to to 1. nil is returned if the mask is impossible.
|
// 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 {
|
func CIDRMask(ones, bits int) IPMask {
|
||||||
if bits != 8*IPv4len && bits != 8*IPv6len {
|
if bits != 8*IPv4len && bits != 8*IPv6len {
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user