Created
May 9, 2014 09:27
-
-
Save rkrishnasanka/56c9f5d138c72cf0fce6 to your computer and use it in GitHub Desktop.
CRC Implementation for the Reaction Wheels
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define POLY 0x8408 /* bits reversed for LSB-first */ | |
unsigned short crc = 0xffff; | |
while (len-- > 0) { | |
unsigned char ch = *bufp++; | |
for (i = 0; i < 8; i++) { | |
crc = (crc >> 1) ˆ ( ((ch ˆ crc) & 0x01) ? POLY : 0 ); | |
ch >>= 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment