Prepare Makefile and README for release 0.5.0
[omfs_fuse.git] / crc.c
blob65c196f285a1fdcdf050c74b59d7570bcb8f333f
2 #include "config.h"
3 #include "crc.h"
5 /* crc-ccitt but with msb first */
6 u16 crc_ccitt_msb(u16 crc, unsigned char *buf, int count)
8 int i, j;
9 for (i=0; i<count; i++)
11 crc ^= buf[i] << 8;
12 for (j = 0; j < 8; j++)
13 crc = (crc << 1) ^ ((crc & 0x8000) ? POLY : 0);
15 return crc;