Line 17... |
Line 17... |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
more details.
|
more details.
|
|
|
You should have received a copy of the GNU General Public License along
|
You should have received a copy of the GNU General Public License along
|
with this program. If not, see <http: www.gnu.org/licenses/>. */
|
with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
This code is commented throughout for use with Doxygen.
|
This code is commented throughout for use with Doxygen.
|
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
|
|
Line 44... |
Line 44... |
@param[in] num_bits The number of bits in the value.
|
@param[in] num_bits The number of bits in the value.
|
@param[in] crc_in The existing CRC
|
@param[in] crc_in The existing CRC
|
|
|
@return The computed CRC. */
|
@return The computed CRC. */
|
/* --------------------------------------------------------------------------*/
|
/* --------------------------------------------------------------------------*/
|
unsigned long int
|
static unsigned long int
|
crc32 (unsigned long long int value,
|
crc32 (unsigned long long int value,
|
int num_bits,
|
int num_bits,
|
unsigned long int crc_in)
|
unsigned long int crc_in)
|
{
|
{
|
if ((1 > num_bits) || (num_bits > 64))
|
if ((1 > num_bits) || (num_bits > 64))
|
Line 58... |
Line 58... |
}
|
}
|
|
|
static const unsigned long int CRC32_POLY = 0x04c11db7;
|
static const unsigned long int CRC32_POLY = 0x04c11db7;
|
int i;
|
int i;
|
|
|
// Compute the CRC, MS bit first
|
/* Compute the CRC, MS bit first */
|
for (i = num_bits - 1; i >= 0; i--)
|
for (i = num_bits - 1; i >= 0; i--)
|
{
|
{
|
unsigned long int d;
|
unsigned long int d;
|
unsigned long int t;
|
unsigned long int t;
|
|
|