int res = aggregator_bucket_compare(left->potential_buckets[i], right->potential_buckets[j]);
if (res == 0)
+ {
+ // log("left: %p, right: %p, res: %d, verdict: EQUAL", left->potential_buckets[i], right->potential_buckets[i], res);
+ // log("Buckets are NOT disjoint");
return 0;
+ }
else if (res == -1)
+ {
+ // log("left: %p, right: %p, res: %d, verdict: LEFT < RIGHT", left->potential_buckets[i], right->potential_buckets[i], res);
i++;
+ }
else if (res == 1)
+ {
+ // log("left: %p, right: %p, res: %d, verdict: LEFT > RIGHT", left->potential_buckets[i], right->potential_buckets[i], res);
j++;
+ }
else
bug("Impossible");
}
+ // log("Buckets are disjoint");
+ // log("==========================================");
return 1;
}
for (int j = i + 1; j < right->potential_buckets_count; j++)
assert(right->potential_buckets[i] != right->potential_buckets[j]);
+ /*
qsort(left->potential_buckets, left->potential_buckets_count, sizeof(struct aggregator_bucket *), aggregator_bucket_compare_wrapper);
qsort(right->potential_buckets, right->potential_buckets_count, sizeof(struct aggregator_bucket *), aggregator_bucket_compare_wrapper);
{
assert((uintptr_t)right->potential_buckets[i - 1] < (uintptr_t)right->potential_buckets[i]);
}
+ */
if (bucket_sets_are_disjoint(left, right))
unionize_buckets(left, right, node);
print_prefixes(proto->root, NET_IP4);
collect_prefixes(proto);
+
+ log("==== AGGREGATION DONE ====");
}
/*