#3718, #3717: Add check for SSE 4.2 and PCLMUL support to native zlib

This commit is contained in:
lax1dude
2024-08-08 18:19:20 +10:00
committed by md_5
parent e49759025f
commit 6b612302e1
10 changed files with 73 additions and 3 deletions

View File

@@ -0,0 +1,22 @@
// Header to check for SSE 4.2 support in compression natives
// GCC only!
#ifndef _INCLUDE_CPUID_HELPER_H
#define _INCLUDE_CPUID_HELPER_H
#include <stdbool.h>
#include <cpuid.h>
static inline bool checkCompressionNativesSupport() {
unsigned int eax;
unsigned int ebx;
unsigned int ecx;
unsigned int edx;
if(__get_cpuid(1, &eax, &ebx, &ecx, &edx)) {
return (ecx & bit_PCLMUL) != 0 && (ecx & bit_SSE4_2) != 0;
}else {
return false;
}
}
#endif // _INCLUDE_CPUID_HELPER_H