On Tuesday 17 May 2011 22:06:34 David Harkness wrote:
> It appears that PHP is truncating the constant 0x8000 to be within
> MIN_INT and MAX_INT instead of as a bit field, but when shifting 1 << 31 it
> doesn't do apply any constraints. That's pretty typical of
> bit-manipulation: it will merri
It appears that PHP is truncating the constant 0x8000 to be within
MIN_INT and MAX_INT instead of as a bit field, but when shifting 1 << 31 it
doesn't do apply any constraints. That's pretty typical of bit-manipulation:
it will merrily slide 1 bits off either end. This explains why & produces 0
On Tuesday 17 May 2011 18:31:00 Bálint Horváth wrote:
> Hi,
> Hmm.. interesting...
> "tst1=-2147483648, tst1_eq=-2147483648, tst1_type=integer tst2=2147483648,
> tst2_eq=-2147483648, tst2_type=double" at me...
> PHP Version 5.3.3-1ubuntu9.5 (Apache 2.0 - i686)
That is what I expected too.
There ar
Hi,
Hmm.. interesting...
"tst1=-2147483648, tst1_eq=-2147483648, tst1_type=integer tst2=2147483648,
tst2_eq=-2147483648, tst2_type=double" at me...
PHP Version 5.3.3-1ubuntu9.5 (Apache 2.0 - i686)
Valentine
On Tue, May 17, 2011 at 5:19 PM, Vitalii Demianets
wrote:
> Hello, all!
>
> I've encounter
Hello, all!
I've encountered odd behavior of PHP regarding bitwise AND operation when
dealing with 31-st bit, and kindly ask to give me some pointers.
Consider the following snippet:
$tst1 = (1 << 31);
$tst2 = 0x8000;
$tst1_eq = $tst1 & 0x8000;
$tst2_eq = $tst2 & 0x8000;
print "tst1=
5 matches
Mail list logo