Merge pull request #20 from NoOne-dev/main

Fix/supernet CIDR calculations
This commit is contained in:
Alicia Sykes authored and GitHub committed 2025-10-21 16:57:16 +01:00
commit 1c799bfc4a
1 file changed
+1 -1
+1 -1
View File
@@ -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;