#include <stdint.h>
extern uint32_t crc32c(uint32_t crc, const void *buf, size_t size);
+extern uint32_t ul_crc32c_exclude_offset(uint32_t crc, const unsigned char *buf,
+ size_t size, size_t exclude_off,
+ size_t exclude_len);
+
#endif /* UL_CRC32C_H */
* code or tables extracted from it, as desired without restriction.
*/
+#include <assert.h>
#include "crc32c.h"
static const uint32_t crc32Table[256] = {
return crc;
}
+
+uint32_t
+ul_crc32c_exclude_offset(uint32_t crc, const unsigned char *buf, size_t size,
+ size_t exclude_off, size_t exclude_len)
+{
+ size_t i;
+ assert((exclude_off + exclude_len) < size);
+
+ crc = crc32c(crc, buf, exclude_off);
+ for (i = 0; i < exclude_len; i++) {
+ uint8_t zero = 0;
+ crc = crc32c(crc, &zero, 1);
+ }
+ crc = crc32c(crc, &buf[exclude_off + exclude_len],
+ size - (exclude_off + exclude_len));
+ return crc;
+}