7257c77e19
I am finally convinced that, given two netip.Prefix values a and b, the expression a.Contains(b.Addr()) || b.Contains(a.Addr()) is functionally equivalent to a.Overlaps(b) The (netip.Prefix).Contains method works by masking the address with the prefix's mask and testing whether the remaining most-significant bits are equal to the same bits in the prefix. The (netip.Prefix).Overlaps method works by masking the longer prefix to the length of the shorter prefix and testing whether the remaining most-significant bits are equal. This is equivalent to shorterPrefix.Contains(longerPrefix.Addr()), therefore applying Contains symmetrically to two prefixes will always yield the same result as applying Overlaps to the two prefixes in either order. Signed-off-by: Cory Snider <csnider@mirantis.com> |
||
---|---|---|
.. | ||
allocator.go | ||
allocator_test.go | ||
parallel_test.go | ||
structures.go | ||
utils.go |