About IP comparison

zhaozj2021-02-16  134

I thought about it in the afternoon, I'm a big prompt to give me a big prompt at the time of the eight-day space, or fill the numbers behind each section, but I can't fill in the eight-degree space. My approach is to give each section when you add a flag, I am using ".". Of course, you can also take out behind when you take each section. "

Then, I used the array to store each number, define 2 3-digit array logip (2), Blockip (2) filled the two of the two to be removed to these 2 arrays,

If the field is 3 numbers plus one ".", Then there will be this point in our array, such as "200." Array is {2,0,0} If the field is 1 number plus one ".", Then After the array reads two fields, it is zero, (default) such as "2." Array is {2,., Null}

Then, according to the bit, the first bit 2, and 2 are equal, but it has not been said, but the second bit is greater than 3 (ASCII), which is more than 200 should be ranked above, the comparison end, and launch cycle.

This is the advantage that the two arches are 3-bit, and it is not necessary to take the judgment whether the field is equal, and of course it is also effective because of the problem of index and dimension.

=================================================================================

If we turn the IP conversion without the use of the binary representation, put the IP to 32-bit binary numbers or modifications to become a complete 10-based number, which is faster, whether it is time complexity or spatial complexity It must be much smaller.

It's really depressed. I only knew the burying code. I didn't analyze it at all. When I found that time overhead was too late.

I have finally doing it.

转载请注明原文地址:https://www.9cbs.com/read-7953.html

New Post(0)