10#define SIZE (262144*3)
13int main(
int argc,
char **argv)
22 buf = (
char*)malloc(
SIZE);
24 fputs(
"out of memory", stderr);
27 while ((got =
read(0, buf,
SIZE)) > 0) {
30 n = (size_t)got - off;
33 crc = argc > 1 ?
crc32c_sw(crc, buf + off,
n) :
36 }
while (off < (
size_t)got);
40 fputs(
"read error\n", stderr);
43 printf(
"%08x\n", crc);
uint32_t crc32c(uint32_t crc, const void *buf, size_t len)
uint32_t crc32c_sw(uint32_t crci, const void *buf, size_t len)