]> Joshua Wise's Git repositories - netwatch.git/blobdiff - lib/crc32.c
Avoid suffering from wrong CS_SEGSEL syndrome.
[netwatch.git] / lib / crc32.c
index fd7bd49dbac871ba0c81c019c0e88a80f9dec189..43f9d7a876ad1dee6818f4b85b56f7861d86af4d 100644 (file)
@@ -5,15 +5,15 @@
 
 uint32_t crc32_table[256];
 
 
 uint32_t crc32_table[256];
 
-uint32_t crc32(uint8_t *buf, int len)
+uint32_t crc32(uint8_t *buf, int len, uint32_t crc0)
 {
        uint8_t *p;
        uint32_t crc;
 
 {
        uint8_t *p;
        uint32_t crc;
 
-       crc = 0xffffffff;       /* preload shift register, per CRC-32 spec */
+       crc = crc0;
        for (p = buf; len > 0; ++p, --len)
                crc = (crc << 8) ^ crc32_table[(crc >> 24) ^ *p];
        for (p = buf; len > 0; ++p, --len)
                crc = (crc << 8) ^ crc32_table[(crc >> 24) ^ *p];
-       return ~crc;        /* transmit complement, per CRC-32 spec */
+       return crc;
 }
 
 /*
 }
 
 /*
This page took 0.025788 seconds and 4 git commands to generate.