mirror of
https://github.com/golang/go
synced 2024-11-21 22:44: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
|
||||
}
|
||||
|
||||
// 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
|
||||
|
Loading…
Reference in New Issue
Block a user