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

Posted by Jochem Maas on 12/30/05 15:08

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

looking at the class I draw the conclusion that it reqires the use of
[some] data in 'long' format (i.e. integers) and the code requires and
assumes that such integers are 32bits long ... which they are on 32bit
systems ... but not on 64bit systems . here in lies the problem, you need
someone more knowledgable than I to give you an actual solution though.

> operation:
>
> (-3281063054 >> 11) produces different results:
> Old System: 495070

this is what you get with a 32bit CPU

> New System: -1048576

this is what you get with a 64bit CPU

>
> 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

$a << $b Shift left Shift the bits of $a $b steps to the left (each step means "multiply by two")
$a >> $b Shift right Shift the bits of $a $b steps to the right (each step means "divide by two")

> function.
>
>
> thanks a lot
> Michael Gross
>

 

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

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