You are here: Re: [PHP] Strange Right-Shift Problem « PHP « IT news, forums, messages
Re: [PHP] Strange Right-Shift Problem

Posted by Curt Zirzow on 01/02/06 21:47

On Fri, Dec 30, 2005 at 12:34:35PM -0600, Richard Lynch wrote:
> On Thu, December 29, 2005 5:37 pm, Michael Gross wrote:
> > Hello
> > I have to migrate a PHP-application to a new Linux-Box. Both the old
> > and
> > the new system are Linux and PHP 5.1.1. (the old one has a Pentium 4,
> > the new one two Xeon CPUs). I have a problem using the
> > Crypt_Xtea-Extension. I narrowed it down to the following right-shift
> > operation:
> >
> > (-3281063054 >> 11) produces different results:
> > Old System: 495070
> > New System: -1048576
> >
> > I understand that both results are "wrong", but everything worked with
> > the old behavior and I need that behavior back very urgent.
> >
> > Maybe someone can explain me in which way the bits are shifted so that
> > the result is 495070? If I understand it, I implement my "own" shift
> > function.
>
> Assuming the previous hypothesis that it's 32-bit versus 64-bit
> machines at work...
>
> If you can determine the number of bits on your system, you could use
> a different number from 11 on the two systems to get the answer you
> want.
>
> if (is_32_bit_machine()){
> $y = $x >> 11;
> }
> else{
> $y = $x >> 43; //11 + 32 (guess)
> }
>
> One hack for detecting 32-bit machine might be this:

Isn't php suppose to handle all this? This seems odd to me.


Curt.
--
cat .signature: No such file or directory

 

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

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