note 118752 added to function.crc32
| From: | toggio at writeme dot com | Date: | Sat, 30 Jan 2016 17:15:40 +0000 |
| Subject: | note 118752 added to function.crc32 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-204807@lists.php.net to get a copy of this message | ||
A faster implementation of modbus CRC16
function crc16($data)
{
$crc = 0xFFFF;
for ($i = 0; $i < strlen($data); $i++)
{
$crc ^=ord($data[$i]);
for ($j = 8; $j !=0; $j--)
{
if (($crc & 0x0001) !=0)
{
$crc >>= 1;
$crc ^= 0xA001;
}
else
$crc >>= 1;
}
}
return $crc;
}
----
Server IP: 72.52.91.14
Probable Submitter: 79.2.93.136
----
Manual Page -- http://php.net/manual/en/function.crc32.php
Edit -- https://master.php.net/note/edit/118752
Del: integrated -- https://master.php.net/note/delete/118752/integrated
Del: useless -- https://master.php.net/note/delete/118752/useless
Del: bad code -- https://master.php.net/note/delete/118752/bad+code
Del: spam -- https://master.php.net/note/delete/118752/spam
Del: non-english -- https://master.php.net/note/delete/118752/non-english
Del: in docs -- https://master.php.net/note/delete/118752/in+docs
Del: other reasons-- https://master.php.net/note/delete/118752
Reject -- https://master.php.net/note/reject/118752
Search -- https://master.php.net/manage/user-notes.php