You are here: Re: Xor bug in all PHP versions « PHP Programming Language « IT news, forums, messages
Re: Xor bug in all PHP versions

Posted by Jim Michaels on 01/24/06 03:45

"DigDug" <dougitman@hotmail.com> wrote in message
news:1137619943.473285.76050@g44g2000cwa.googlegroups.com...
>I get two different results in doing a Xor on a large signed double
> between linux servers.
> working system is kernel 2.4 . bad results server is kernel 2.6.
>
> PHP version does not matter. I compile PHP from 4.2.2 to latest.
>
> test code:
> <?PHP echo -4738698913 ^ 43814; ?>
>
> results:
>
> Good result from 2.4 kernel system is -443704711
> Bad result from 2.6 kernel systems(tried 5 different systems) is
> -2147439834
>

2.6 kernel system is at least a 64-bit base. it's not a bug.
-4738698913=0xFFFF FFFE E58D 315F
43814=0x0000 0000 0000 AB26
-2147439834=0xFFFF FFFF 8000 AB26
that last number is what I get for a result from a 64-bit calculator.

When a C or C++ program like PHP is compiled on a 64-bit processor or using
flags for 64-bit int's, you will probably get this. The size of an int will
become 64 bits, not 32. similarly, if you are compiling on a 16-bit
processor and no 32-bit registers are available, you may get 16-bit ints.
The manual doesn't seem to take this into account. possibly 64-bit
processors were not supported until later versions of gcc and/or kernel? or
possibly (more likely) the default settings for the processor are stored in
the kernel.

> BUG in PHP or kernel?
>

 

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

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