i HATE ZLIB PART 2

This commit is contained in:
wuggy 2026-04-16 19:42:31 -04:00
commit 26f7249898
2 changed files with 30 additions and 0 deletions

View file

@ -0,0 +1,29 @@
// Minimal CRC folding stubs for builds without CRC SIMD support.
#include "zutil.h"
#include "crc32.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)
{
// Initialize to standard CRC-32 initial value.
crc->crc = 0xffffffffu;
}
void crc_fold_copy(crc32_fold *crc,
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);
}
uint32_t crc_fold_512to32(crc32_fold *crc)
{
// Finalize CRC (invert bits as usual).
return crc->crc ^ 0xffffffffu;
}

View file

@ -38,6 +38,7 @@ if CONFIG['INTEL_ARCHITECTURE']:
DEFINES['INFLATE_CHUNK_SIMD_SSE2'] = False
DEFINES['CRC32_SIMD_SSE42_PCLMUL'] = False
SOURCES += [
'crc32_stub.c',
'simd_stub.c',
]
else: