Add a function for LDM enable check
diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c
index 6d5da4b..404f38d 100644
--- a/lib/compress/zstd_compress.c
+++ b/lib/compress/zstd_compress.c
@@ -202,6 +202,14 @@
 /* private API call, for dictBuilder only */
 const seqStore_t* ZSTD_getSeqStore(const ZSTD_CCtx* ctx) { return &(ctx->seqStore); }
 
+/* Returns 1 if compression parameters are such that we should
+ * enable long distance matching (wlog >= 27, strategy >= btopt).
+ * Returns 0 otherwise.
+ */
+static U32 ZSTD_CParams_shouldEnableLdm(const ZSTD_compressionParameters* const cParams) {
+    return cParams->strategy >= ZSTD_btopt && cParams->windowLog >= 27;
+}
+
 static ZSTD_CCtx_params ZSTD_makeCCtxParamsFromCParams(
         ZSTD_compressionParameters cParams)
 {
@@ -210,7 +218,7 @@
     ZSTD_CCtxParams_init(&cctxParams, ZSTD_CLEVEL_DEFAULT);
     cctxParams.cParams = cParams;
 
-    if (cParams.strategy >= ZSTD_btopt && cParams.windowLog >= 27 && cctxParams.nbWorkers == 0) {
+    if (ZSTD_CParams_shouldEnableLdm(&cParams)) {
         DEBUGLOG(4, "ZSTD_makeCCtxParamsFromCParams(): Including LDM into cctx params");
         cctxParams.ldmParams.enableLdm = 1;
         /* LDM is enabled by default for optimal parser and window size >= 128MB */
@@ -4188,7 +4196,7 @@
                     dictSize, mode);
         }
 
-        if (params.cParams.strategy >= ZSTD_btopt && params.cParams.windowLog >= 27) {
+        if (ZSTD_CParams_shouldEnableLdm(&params.cParams)) {
             /* Enable LDM by default for optimal parser and window size >= 128MB */
             DEBUGLOG(4, "LDM enabled by default (window size >= 128MB, strategy >= btopt)");
             params.ldmParams.enableLdm = 1;