 |
Forums |
Admin Start New Thread
By: Erik Hollensbe
RE: Address.pack [ reply ] 2005-11-14 00:42
|
The "above 255" reason is exactly the reason.
It is probably more appropriate to raise an exception here, but the ultimate reason is to constrain it to an 8-bit number.
"Checking it would be slower" is the only honest reason I can give you, but that's not a very good one.
I'm releasing 0.0.2 now, but this will be in 0.0.3, along with a couple of other things.
|
By: Tim Howe
Address.pack [ reply ] 2005-11-10 02:27
|
I've been looking at the code (because I need some direction for an address management application) and I am a bit confused by Address.pack.
I am hoping you can tell me what the purpose of the bitwise AND is at:
4.times { |x| ret = ret | (myip[x] & 0xFF) << 8*x }
Wouldn't that just always return whatever myip[x] is? UNless, of course, the octet was more than 255, in which case shouldn't it raise an exception?
I'm very new to some of these concepts so thank you very much for your time.
--paca
|
|
 |