Re: Failure in bitwise operations moving from 5.2.x to 5.3.x

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Now:  I did a little more looking around this morning, and it looks
> like I may well run into problems here given that I'm moving from a
> 32-bit architecture to a 64-bit architecture.  Bitwise math is still
> fairly obscure to me, so it's likely that I'm overlooking something
> obvious, but maybe instead of asking "How do I fix this?" I should be
> asking "What would the right way to do this have been?"  As I think I
> said before, I didn't actually write most of this code, I inherited
> it, and as long as the input and output of the class remain the same,
> I don't actually care how the work is done.
>
>
> If anyone has any useful input here, I'd appreciate it!
>
> -Alex
>

As it turns out, the most important lesson here is:  "Don't trust what
anyone tells you."  The old server is 64-bit.  The new server is
32-bit.  Once I stopped to check that myself, it all became clear.
For the archives, here's what happened.

Everything worked fine until I ran bindec() on the binary netmask;  at
that point it returned a float rather than an int, as it it used to.
Therefore, when I ran ip2long on the result, it choked, and returned
bool(false).  Which isn't really useful when you're trying to produce
a human-readable netmask, when you get right down to it.

I still don't have a solution that will work on a 32-bit server, but
now that I know what's going on, I should be able to either find
something that will work, or get things moved to a 64-bit machine.


-Alex

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux