note 79662 added to language.operators.bitwise
| From: | forlamp at msn dot com | Date: | Fri, 07 Dec 2007 02:35:50 +0000 |
| Subject: | note 79662 added to language.operators.bitwise | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-132916@lists.php.net to get a copy of this message | ||
two's complement logical operation for 32-bit.
$x must be (int) when passing it to this function to work properly.
function comp2($x) // 32bit bitwise complement
{
$mask = 0x80000000;
if ($x < 0)
{
$x &= 0x7FFFFFFF;
$x = ~$x;
return $x ^ $mask;
}
else
{
$x = $x ^ 0x7FFFFFFF;
return $x | $mask;
}
}
----
Server IP: 216.235.15.211
Probable Submitter: 70.66.9.108
----
Manual Page -- http://www.php.net/manual/en/language.operators.bitwise.php
Edit -- https://master.php.net/note/edit/79662
Del: integrated -- https://master.php.net/note/delete/79662/integrated
Del: useless -- https://master.php.net/note/delete/79662/useless
Del: bad code -- https://master.php.net/note/delete/79662/bad+code
Del: spam -- https://master.php.net/note/delete/79662/spam
Del: non-english -- https://master.php.net/note/delete/79662/non-english
Del: in docs -- https://master.php.net/note/delete/79662/in+docs
Del: other reasons-- https://master.php.net/note/delete/79662
Reject -- https://master.php.net/note/reject/79662
Search -- https://master.php.net/manage/user-notes.php