Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
"be consistent"
 
PerlMonks  

Re: Re: Merge CIDRs

by merlyn (Sage)
on Oct 15, 2001 at 01:44 UTC ( [id://118800]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: Merge CIDRs
in thread Merge CIDRs

You need to sort by start address. You're lucky that your input data was already sorted by such.

Also, you have to look for $rs <= $ce + 1 rather than $rs == $ce + 1, or you end up not coalescing things like 0-7 (0.0/3), 4-7 (4.0/2), which should just get swallowed.

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: Merge CIDRs
by Dominus (Parson) on Oct 15, 2001 at 05:50 UTC
    Says merlyn:
    You need to sort by start address. You're lucky that your input data was already sorted by such.
    No, I'm not. My original problem specification guaranteed sorted input.

    Anyway, those changes wouldn't slow down the program so much that I'd prefer to use the code you posted above. But you said the code above was an order of magnitude faster, not an order of magnitude slower, so I wonder what's up? Someone made a mistake, and I'm less than 50% confident that it was you.

    --
    Mark Dominus
    Perl Paraphernalia

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://118800]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.