Bitwise operations on large integers
| From: | Matthew H. North | Date: | Thu, 20 Jul 2000 22:36:48 +0000 |
| Subject: | Bitwise operations on large integers | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-7487@lists.php.net to get a copy of this message | ||
Using PHP4.0.1pl2, this happens:
$var = 0xFFFFFFFF;
print "$var\n";
That prints 0. ????
$var = 0x7FFFFFFF + 0x7FFFFFFF + 1;
print "$var\n";
Prints 4294967295, as it should (and as the previous example should).
$var = 0x7FFFFFFF + 0x7FFFFFFF + 1;
$shifted = $var << 1;
print "$shifted\n";
That prints 0. It should be printing 4294967294.
I got an email from one of the developers saying it's been fixed in the
altest CVS. How about a patch? Is there a patch for this somewhere?
Matthew H. North
Software Engineer
CTSnet Internet Services
t (858) 637-3600
f (858) 637-3630
mailto:ctsmhn@cts.com