2 ms·
Because of IPv6. You'll need a 128bit word for that. Plus some bignum math libraries for 32 machines that don't do 128 bits natively. (Do 64 bit machines handl
by ars 17y ago
Because of IPv6.
You'll need a 128bit word for that. Plus some bignum math libraries for 32 machines that don't do 128 bits natively. (Do 64 bit machines handle 128 bits natively?)
Also watch out that you use an unsigned int. In PHP for example (and probably most other dynamic languages that don't do bignum as well) all ints are signed. So you'll have to work with the number as a string.
- dpifke 17y agoI'd be curious if matching 128 bit words is slower or more painful than variable-length string comparisons in any RDBMS. I would bet not. Plus, you can't do CIDR operations on strings, making it a pain to i.e. match all addresses within a given /27.
- audidude 17y agoYou will often have to do a page-fault for both, so loading wont be too much an issue. However, you have to get it into an integer to compare it to begin with. So the string method is purely overhead.
- deleted 17y ago[deleted]