Add possibility for miniz to use an external crc definition. (#27558)
Summary:
We add an #ifdef check for USE_EXTERNAL_MZCRC, in which case miniz
will look for an external mz_crc32 definition. The default behavior
is unchanged.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27558
Test Plan: Unchanged default behavior, but buck test caffe2/test/...
Differential Revision: D17814440
Pulled By: jjlilley
fbshipit-source-id: e4ecbe37ee2f9eec176093372f21b3b8e52a5f81
diff --git a/third_party/miniz-2.0.8/miniz.c b/third_party/miniz-2.0.8/miniz.c
index 08653d1..dc5178d 100755
--- a/third_party/miniz-2.0.8/miniz.c
+++ b/third_party/miniz-2.0.8/miniz.c
@@ -82,6 +82,12 @@
}
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.
*/