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:
parent
8329d4add7
commit
4cc28b8dd8
@ -340,7 +340,7 @@ function network_address(ip, mask)
|
|||||||
|
|
||||||
function subnet_addresses(mask)
|
function subnet_addresses(mask)
|
||||||
{
|
{
|
||||||
return 1<<(32-mask);
|
return 2**(32-mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
function subnet_last_address(subnet, mask)
|
function subnet_last_address(subnet, mask)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user