You are here: PHP on Solaris (2.6) and integer overflow « PHP Programming Language « IT news, forums, messages
PHP on Solaris (2.6) and integer overflow

Posted by writeson on 12/28/05 19:33

Hi all,

I have PHP version 4.4 installed on a Soaris 2.6 system and I'm getting
strange results doing math/boolean operators. I have a hashing
algorithm that does multiplication, bitwise operations and mod() calls
interatively on the characters of a filename. On a linux platform the
multiplications start to overflow (as I expect) and the overflow is
just dropped. The lower three bytes are masked off like this:

$result = $result & 0x00FFFFFF;

and the loop continues. On the Solaris platform the multiplication
fails very quickly in the loop, and it looks like the overflow bits are
wrapped around onto the lower order bytes, eventually I end up with an
interger value of 0x00FFFFFF because of the masking above. To solve the
problem I had to compile the gmp_* function support into PHP and work
with the gmp_* family of functions.

Has anyone ever seen this behavior before, and if so can you enlighten
me about it?

Thanks,
Doug

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация