rust/library/core
bors 96561a8fd1 Auto merge of #121428 - okaneco:ipaddr_parse, r=cuviper
net: Don't use checked arithmetic when parsing numbers with known max digits

Add a branch to `Parser::read_number` that determines whether checked or regular arithmetic is used.

- If `max_digits.is_some()`, then we know we are parsing a `u8` or `u16` because `read_number` is only called with `Some(3)` or `Some(4)`. Both types fit within a `u32` without risk of overflow. Thus, we can use plain arithmetic to avoid extra instructions from `checked_mul` and `checked_add`.

Add benches for `IpAddr`, `Ipv4Addr`, `Ipv6Addr`, `SocketAddr`, `SocketAddrV4`, and `SocketAddrV6` parsing
2024-03-05 15:29:19 +00:00
..
benches Add benches for net parsing 2024-03-04 18:46:24 -05:00
src Auto merge of #121428 - okaneco:ipaddr_parse, r=cuviper 2024-03-05 15:29:19 +00:00
tests Auto merge of #120393 - Urgau:rfc3373-non-local-defs, r=WaffleLapkin 2024-02-25 19:11:06 +00:00
Cargo.toml Update rand in the stdlib tests, and remove the getrandom feature from it 2023-01-04 14:52:41 -08:00