UltraScan III
us_crc.cpp
Go to the documentation of this file.
1 #include "us_crc.h"
2 
3 quint32 US_Crc::crc32(
4  quint32 crc, const unsigned char* buf, unsigned int len )
5 {
6  if ( buf == 0 ) return 0UL;
7 
8  crc = crc ^ 0xffffffffUL;
9 
10  if ( len ) do
11  {
12  crc = crc_table[ ( (int)crc ^ ( *buf++ ) ) & 0xff ] ^ ( crc >> 8 );
13  } while ( --len );
14 
15  return crc ^ 0xffffffffUL;
16 }