mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-26 00:57:30 +09:00
HOLY SHIT IT LAUNCHES
This commit is contained in:
parent
26f7249898
commit
a835672d9b
2 changed files with 22 additions and 18 deletions
|
|
@ -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 "deflate.h"
|
||||||
#include "crc32.h"
|
#include <string.h>
|
||||||
|
|
||||||
// The folded CRC state type is declared in crc32.h as crc32_fold (or similar).
|
void ZLIB_INTERNAL crc_fold_init(deflate_state *const s)
|
||||||
// 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.
|
s->strm->adler = crc32(0L, Z_NULL, 0);
|
||||||
crc->crc = 0xffffffffu;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void crc_fold_copy(crc32_fold *crc,
|
void ZLIB_INTERNAL crc_fold_copy(deflate_state *const s,
|
||||||
unsigned char *dst,
|
unsigned char *dst,
|
||||||
const unsigned char *src,
|
const unsigned char *src,
|
||||||
long len)
|
long len)
|
||||||
{
|
{
|
||||||
// Simple scalar copy + CRC update.
|
|
||||||
memcpy(dst, src, (size_t)len);
|
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 (unsigned)s->strm->adler;
|
||||||
return crc->crc ^ 0xffffffffu;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,11 @@ static void _x86_check_features(void)
|
||||||
x86_cpu_enable_simd = x86_cpu_has_sse2 &&
|
x86_cpu_enable_simd = x86_cpu_has_sse2 &&
|
||||||
x86_cpu_has_sse42 &&
|
x86_cpu_has_sse42 &&
|
||||||
x86_cpu_has_pclmulqdq;
|
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__
|
#ifdef __APPLE__
|
||||||
/* SIMD implementations not built on Darwin; disable even if CPU supports them */
|
/* SIMD implementations not built on Darwin; disable even if CPU supports them */
|
||||||
x86_cpu_enable_simd = 0;
|
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_enable_simd = x86_cpu_has_sse2 &&
|
||||||
x86_cpu_has_sse42 &&
|
x86_cpu_has_sse42 &&
|
||||||
x86_cpu_has_pclmulqdq;
|
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 */
|
#endif /* _MSC_VER */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue