Collection of different CRC calculations
Work in Progress
Revision 1:ec8513f94d23, committed 2013-05-14
- Comitter:
- sam_grove
- Date:
- Tue May 14 22:14:09 2013 +0000
- Parent:
- 0:28e16d33040f
- Commit message:
- untested but just formatted
Changed in this revision
crc.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 28e16d33040f -r ec8513f94d23 crc.cpp --- a/crc.cpp Tue May 14 21:54:06 2013 +0000 +++ b/crc.cpp Tue May 14 22:14:09 2013 +0000 @@ -13,9 +13,13 @@ for (int j = 8 ; j > 0; j-- ) { if ( ulCRC & 1 ) + { ulCRC = ( ulCRC >> 1 ) ^ CRC32_POLYNOMIAL; + } else + { ulCRC >>= 1; + } } CRC = ulTemp1 ^ ulCRC; } @@ -33,7 +37,10 @@ //the below code tests the CRC32Value procedure used in a markov form ////////////////////////////////////////////////////////////////////// unsigned long CRC = 0; - for (int i = 0; i<ulCount; i++) CRC32Value( CRC, *ucBuffer++ ); + for (int i = 0; i<ulCount; i++) + { + CRC32Value( CRC, *ucBuffer++ ); + } return CRC; }