#2 Added new function to convert an IPv4 Address to an Unsigned 32-bit interger. Also did some small bits of code cleanup

This commit is contained in:
2023-05-15 19:22:02 +01:00
parent 55ccf05902
commit 4ace257932
2 changed files with 40 additions and 2 deletions

View File

@ -55,7 +55,6 @@ impl Network {
//Get number of host and network bits.
let network_class = Network::get_network_class(network_address)?;
let network_address = network_address.to_arr()?;
//let subnet_mask = Network::gen_subnet_mask(cidr)?.to_arr()?;
// If the CIDR < class network enum associated value, then there is an invalid subnet.
if cidr < network_class as u8 {
@ -76,7 +75,7 @@ impl Network {
base_network[i as usize] = 0;
}
// Determine how many networks available
// Determine how many networks are available
// We know that this value is >0 at this point
let num_networks = u32::pow(2, num_borrowed_bits as u32);