Skip to content

Commit 795e79c

Browse files
committed
Calculate crc on the fly
1 parent 048cc1d commit 795e79c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/isal/isal_zlibmodule.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ ParallelCompress__new__(PyTypeObject *type, PyObject *args, PyObject *kwargs)
347347
self->buffer_size = buffer_size;
348348
self->zst.level_buf = level_buf;
349349
self->zst.level_buf_size = level_buf_size;
350-
self->zst.gzip_flag = IGZIP_DEFLATE;
350+
self->zst.gzip_flag = IGZIP_GZIP_NO_HDR;
351351
self->zst.hist_bits = ISAL_DEF_MAX_HIST_BITS;
352352
self->zst.level = (uint32_t)level;
353353
self->zst.flush = SYNC_FLUSH;
@@ -404,7 +404,6 @@ ParallelCompress_compress_and_crc(ParallelCompress *self, PyObject *args)
404404
goto error;
405405
}
406406
err = isal_deflate(&self->zst);
407-
uint32_t crc = crc32_gzip_refl(0, data.buf, data.len);
408407
Py_BLOCK_THREADS;
409408

410409
if (err != COMP_OK) {
@@ -434,7 +433,7 @@ ParallelCompress_compress_and_crc(ParallelCompress *self, PyObject *args)
434433
}
435434
PyBuffer_Release(&data);
436435
PyBuffer_Release(&zdict);
437-
PyObject *ret= Py_BuildValue("(OI)", out_bytes, crc);
436+
PyObject *ret= Py_BuildValue("(OI)", out_bytes, self->zst.internal_state.crc);
438437
Py_DECREF(out_bytes);
439438
return ret;
440439
error:

0 commit comments

Comments
 (0)