Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. unsigned short crc16 (const void *data, unsigned data_size)
  2. {
  3. if (!data || !data_size)
  4. return 0;
  5. unsigned short crc = 0;
  6. unsigned char* buf = (unsigned char*)data;
  7. while (data_size--)
  8. crc = (crc >> 8) ^ crc16_table[(unsigned char)crc ^ *buf++];
  9. return crc;
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement