func (n Network) LeastCommonBitPosition(n1 Network) (uint, error) {
	maskSize, _ := n.IPNet.Mask.Size()
	if maskSize1, _ := n1.IPNet.Mask.Size(); maskSize1 < maskSize {
		maskSize = maskSize1
	}
	maskPosition := len(n1.Number)*BitsPerUint32 - maskSize
	lcb, err := n.Number.LeastCommonBitPosition(n1.Number)
	if err != nil {
		return 0, err
	}
	return uint(math.Max(float64(maskPosition), float64(lcb))), nil
}
func (n Network) LeastCommonBitPosition(n1 Network) (uint, error) {
	maskSize, _ := n.IPNet.Mask.Size()
	if maskSize1, _ := n1.IPNet.Mask.Size(); maskSize1 < maskSize {
		maskSize = maskSize1
	}
	maskPosition := len(n1.Number)*BitsPerUint32 - maskSize
	lcb, err := n.Number.LeastCommonBitPosition(n1.Number)
	if err != nil {
		return 0, err
	}
	return uint(math.Max(float64(maskPosition), float64(lcb))), nil
}
func ( n Network ) LeastCommonBitPosition ( n1 Network ) ( uint , error ) { maskSize , _ := n . IPNet . Mask . Size ( ) if maskSize1 , _ := n1 . IPNet . Mask . Size ( ) ; maskSize1 < maskSize { maskSize = maskSize1 } maskPosition := len ( n1 . Number ) * BitsPerUint32 - maskSize lcb , err := n . Number . LeastCommonBitPosition ( n1 . Number ) if err != nil { return 0 , err } return uint ( math . Max ( float64 ( maskPosition ) , float64 ( lcb ) ) ) , nil }
// LeastCommonBitPosition returns the smallest position of the preceding common
// bits of the 2 networks, and returns an error ErrNoGreatestCommonBit
// if the two network number diverges from the first bit.
LeastCommonBitPosition returns the smallest position of the preceding common bits of the 2 networks and returns an error ErrNoGreatestCommonBit if the two network number diverges from the first bit .