Skip to content

Commit

Permalink
Add #elif to enable an external mz_crc32() to be linked in.
Browse files Browse the repository at this point in the history
Adds '#elif defined(USE_EXTERNAL_MZCRC)' by the mz_crc32() definition
to enable the option of a user linking in an alternate crc implementation.

The main reason why this might be desired would be to use an SSE-accelerated
crc implementaiton, which would be faster, but not be reasonable to include
in this file.
  • Loading branch information
jeremyl committed Oct 9, 2019
1 parent 107def8 commit a0dd517
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions miniz.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len)
}
return ~crcu32;
}
#elif defined(USE_EXTERNAL_MZCRC)
/* If USE_EXTERNAL_CRC is defined, an external module will export the
* mz_crc32() symbol for us to use, e.g. an SSE-accelerated version.
* Depending on the impl, it may be necessary to ~ the input/output crc values.
*/
mz_ulong mz_crc32(mz_ulong crc, const mz_uint8 *ptr, size_t buf_len);
#else
/* Faster, but larger CPU cache footprint.
*/
Expand Down

0 comments on commit a0dd517

Please sign in to comment.