mirror of
https://github.com/lissy93/networking-toolbox.git
synced 2026-11-29 16:40:46 +03:00
Merge pull request #20 from NoOne-dev/main
Fix/supernet CIDR calculations
This commit is contained in:
1 file changed
+1
-1
@@ -152,7 +152,7 @@ function findSupernet(networks: NetworkInput[]): { network: string; cidr: number
|
||||
|
||||
// Find the smallest CIDR that can contain all networks
|
||||
let supernetCidr = 32;
|
||||
for (let cidr = 1; cidr <= 30; cidr++) {
|
||||
for (let cidr = 30; cidr >= 1; cidr--) {
|
||||
const mask = 0xffffffff << (32 - cidr);
|
||||
const supernetStart = minAddress & (mask >>> 0);
|
||||
const supernetEnd = supernetStart + Math.pow(2, 32 - cidr) - 1;
|
||||
|
||||
Reference in new issue
Block a user