Change shift left operator to exponent operator to avoid overflow

Large numbers of hosts (/0 and /1 subnets) are overflowing and showing
as a negative number.  Changing 1<<(32-mask) to 2**(32-mask) causes
JavaScript to calculate the integer properly.
This commit is contained in:
Kevin A. Pieckiel
2023-01-06 18:22:45 -05:00
parent 8329d4add7
commit 4cc28b8dd8

View File

@@ -340,7 +340,7 @@ function network_address(ip, mask)
function subnet_addresses(mask)
{
return 1<<(32-mask);
return 2**(32-mask);
}
function subnet_last_address(subnet, mask)