NetNessie
08-19-2008, 10:19 AM
It appears my absences from around here usually end when I hit a brick wall programming that Google can't easily answer.
Anywho, I've got a problem with the bitwise AND operation on floats in PHP.
Basically my operation goes:
echo (0xF4FF04F4 & 0xFF000000) >> 24;
With the first float being any float ranging from 0x00000000 to 0xFFFFFFFF. I tested the code in Python and it returned 244 as expected, except PHP turns around and returns a fantastically incorrect -12.
PHP behaves it self fairly well up until I use something larger than 7F. Once I write 7F, it starts getting into the negatives and all my operations go awry.
Any clues as to how I can convince PHP to behave?
Anywho, I've got a problem with the bitwise AND operation on floats in PHP.
Basically my operation goes:
echo (0xF4FF04F4 & 0xFF000000) >> 24;
With the first float being any float ranging from 0x00000000 to 0xFFFFFFFF. I tested the code in Python and it returned 244 as expected, except PHP turns around and returns a fantastically incorrect -12.
PHP behaves it self fairly well up until I use something larger than 7F. Once I write 7F, it starts getting into the negatives and all my operations go awry.
Any clues as to how I can convince PHP to behave?