HOLY SHIT IT LAUNCHES

This commit is contained in:
wuggy 2026-04-16 19:58:56 -04:00
commit a835672d9b
2 changed files with 22 additions and 18 deletions

View file

@ -1,29 +1,23 @@
// Minimal CRC folding stubs for builds without CRC SIMD support.
// Scalar CRC fallback for builds that disable CRC SIMD folding.
#include "zutil.h"
#include "crc32.h"
#include "deflate.h"
#include <string.h>
// The folded CRC state type is declared in crc32.h as crc32_fold (or similar).
// We don't use any SIMD here; we just fall back to scalar crc32.
void crc_fold_init(crc32_fold *crc)
void ZLIB_INTERNAL crc_fold_init(deflate_state *const s)
{
// Initialize to standard CRC-32 initial value.
crc->crc = 0xffffffffu;
s->strm->adler = crc32(0L, Z_NULL, 0);
}
void crc_fold_copy(crc32_fold *crc,
unsigned char *dst,
const unsigned char *src,
long len)
void ZLIB_INTERNAL crc_fold_copy(deflate_state *const s,
unsigned char *dst,
const unsigned char *src,
long len)
{
// Simple scalar copy + CRC update.
memcpy(dst, src, (size_t)len);
crc->crc = crc32(crc->crc, src, (uInt)len);
s->strm->adler = crc32(s->strm->adler, dst, (uInt)len);
}
uint32_t crc_fold_512to32(crc32_fold *crc)
unsigned ZLIB_INTERNAL crc_fold_512to32(deflate_state *const s)
{
// Finalize CRC (invert bits as usual).
return crc->crc ^ 0xffffffffu;
return (unsigned)s->strm->adler;
}

View file

@ -59,6 +59,11 @@ static void _x86_check_features(void)
x86_cpu_enable_simd = x86_cpu_has_sse2 &&
x86_cpu_has_sse42 &&
x86_cpu_has_pclmulqdq;
#if !defined(INFLATE_CHUNK_SIMD_SSE2) || !(INFLATE_CHUNK_SIMD_SSE2) || \
!defined(CRC32_SIMD_SSE42_PCLMUL) || !(CRC32_SIMD_SSE42_PCLMUL)
/* Runtime SIMD must stay off if required SIMD objects were not built. */
x86_cpu_enable_simd = 0;
#endif
#ifdef __APPLE__
/* SIMD implementations not built on Darwin; disable even if CPU supports them */
x86_cpu_enable_simd = 0;
@ -122,5 +127,10 @@ static void _x86_check_features(void)
x86_cpu_enable_simd = x86_cpu_has_sse2 &&
x86_cpu_has_sse42 &&
x86_cpu_has_pclmulqdq;
#if !defined(INFLATE_CHUNK_SIMD_SSE2) || !(INFLATE_CHUNK_SIMD_SSE2) || \
!defined(CRC32_SIMD_SSE42_PCLMUL) || !(CRC32_SIMD_SSE42_PCLMUL)
/* Runtime SIMD must stay off if required SIMD objects were not built. */
x86_cpu_enable_simd = 0;
#endif
}
#endif /* _MSC_VER */