Reply to Re: Right Shift

Your name:

Reply:


Posted by Oli Filth on 10/04/55 11:42

CrashRoX said the following on 15/03/2006 10:32:
> Here's some confusion for you...
>
> <?PHP
> $x = (4653896912 >> 13);
> echo $x;
> ?>
>
> I ran that on two different servers.
>
> Server A gave me: 43814
> Server B gave me: 568102
>
> I have been hacking away and researching this for hours. I am
> completely clueless. Any suggestions or workarounds? Thanks in advance.
>

4653896912 is bigger than can be represented as a signed-int on a 32-bit
platform, so gets truncated to 358929616. And (358929616 >> 13) == 43814.

However, 4653896912 can be represented as a signed-int on a 64-bit
platform, giving the "correct" answer of 568102.


[NOTE: I haven't checked this to see if it's right though...]

--
Oli

[Back to original 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

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