note 8530 deleted from language.operators.bitwise by sniper
| From: | sniper@php.net | Date: | Mon, 13 Oct 2003 00:10:50 +0000 |
| Subject: | note 8530 deleted from language.operators.bitwise by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58399@lists.php.net to get a copy of this message | ||
Note Submitter: terium@techie.com
----
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;
}