Is It PHP's Bug?
Posted: Thu Aug 09, 2007 5:13 am
Everah | Please use
===========================
Output
===========================[/syntax]
Everah | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
In java the following code generates the following output. But when i converted this code to PHP, the output was not same. Even i tried with 64 bit bitwise operation. Anybody can convert this snippet to PHP so that the same result come?
[syntax="java"]long a = 0;
long c = -589949350;
for(int j=0;j<4;j++)
{
a=(a^c&0xff)*0x9e3779b1;
c=c>>8;
println(a);
println(c);
}
Output
===========================[/syntax]
Code: Select all
Loop 1:
-------
a = -147647838150
c = -2304490
Loop 2:
-------
a = 2413261624394330732
c = -9002
Loop 3:
-------
a = 4360021387243289754
c = -36
Loop 4:
-------
a = -5030538659600629146
c = -1Everah | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]