note 96262 added to function.crc32
| From: | jian at theorchard dot com | Date: | Wed, 17 Feb 2010 18:13:28 +0000 |
| Subject: | note 96262 added to function.crc32 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-166086@lists.php.net to get a copy of this message | ||
This function returns an unsigned integer from a 64-bit Linux platform. It does return the signed
integer from other 32-bit platforms even a 64-bit Windows one.
The reason is because the two constants PHP_INT_SIZE and PHP_INT_MAX have different values on the
64-bit Linux platform.
I've created a work-around function to handle this situation.
function get_signed_int($in) {
$int_max = pow(2, 31)-1;
if ($in > $int_max){
$out = $in - $int_max * 2 - 2;
}
else {
$out = $in;
}
return $out;
}
Hope this helps.
----
Server IP: 208.69.120.55
Probable Submitter: 67.152.24.226
----
Manual Page -- http://www.php.net/manual/en/function.crc32.php
Edit -- https://master.php.net/note/edit/96262
Del: integrated -- https://master.php.net/note/delete/96262/integrated
Del: useless -- https://master.php.net/note/delete/96262/useless
Del: bad code -- https://master.php.net/note/delete/96262/bad+code
Del: spam -- https://master.php.net/note/delete/96262/spam
Del: non-english -- https://master.php.net/note/delete/96262/non-english
Del: in docs -- https://master.php.net/note/delete/96262/in+docs
Del: other reasons-- https://master.php.net/note/delete/96262
Reject -- https://master.php.net/note/reject/96262
Search -- https://master.php.net/manage/user-notes.php