ip6: partially replace math.big, Ipv6Net iterator performance up to x3.2 times better with TCC and up to x2 with -prod

This commit is contained in:
ge
2025-04-23 02:27:17 +03:00
parent 023b399a32
commit cf39b623ae
2 changed files with 19 additions and 10 deletions

View File

@ -185,6 +185,12 @@ fn test_ipv6_net_format() {
assert net.format(.verbose | .with_host_mask) == 'fe80:ffff:0000:0000:0000:0000:0000:0000/0000:0000:0000:0000:ffff:ffff:ffff:ffff'
}
fn test_ipv6_net_first_last() {
net := netaddr.Ipv6Net.from_string('fe80:ffff::/64')!
assert net.first().str() == 'fe80:ffff::1'
assert net.last().str() == 'fe80:ffff::ffff:ffff:ffff:fffe'
}
fn test_ipv6_net_next() {
net := netaddr.Ipv6Net.from_string('fe80::/64')!
mut addrs := []netaddr.Ipv6Addr{}