note 8530 added to Bitwise Operators
| From: | terium at techie dot com | Date: | Fri, 15 Sep 2000 05:10:42 +0000 |
| Subject: | note 8530 added to Bitwise Operators | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-5037@lists.php.net to get a copy of this message | ||
Here is a function which will do the zero fill shift right bitwise operator (>>>) which I
haven't found in PHP but Java/JavaScript do have. The resulting number is always positive
unlike >>.
function zeroFill($a, $b) {
$z = hexdec(80000000);
if ($z & $a) {
$a >>= 1;
$a &= (~ $z);
$a |= 0x40000000;
$a >>= ($b-1);
} else {
$a >>= $b;
}
return $a;
}
http://www.php.net/manual/language.operators.bitwise.php