|
Posted by d on 11/04/79 11:41
<fritz-bayer@web.de> wrote in message
news:1141404106.485472.53880@z34g2000cwc.googlegroups.com...
> Hello,
>
> I'm porting a program from php to perl and discovered, that the bitwise
> operator & seems to work differently, which I don't understand why.
>
> I tested it with the values:
>
> a=5543039447 and b=13
>
> Then in perl the expressions:
>
> $result= ($z & $a);
>
> returns 2147483648.
>
> But in php the same expression returns zero. Why is that and how can I
> fix it?!
If you have defined $a and $b, then bitwise-anded $z and $a, you *should*
get zero, as zero AND anything is zero. If, however, you do bitwise-and $a
and $b, you shouldn't get 2147483648 in the first place, so I don't know
where your problem is :)
> Fritz
>
[Back to original message]
|