Canonicalize CIDR: Difference between revisions

Content added Content deleted
(→‎{{header|Python}}: trim whitespace)
No edit summary
Line 1: Line 1:
{{task}}
{{task}}


Implement a function or program that, given a range of IP addresses in CIDR notation (dotted-decimal/network-bits), will return/output the same range in canonical form, that is, with none of the host bits set.
Implement a function or program that, given a range of IPv4 addresses in CIDR notation (dotted-decimal/network-bits), will return/output the same range in canonical form. That is, the IP address portion of the output CIDR block must not contain any set (1) bits in the host part of the address.


Example: given 87.70.141.1/22, your code should output 87.70.140.0/22.
Example: given 87.70.141.1/22, your code should output 87.70.140.0/22.