fix cpu check for arm

Signed-off-by: R4SAS <r4sas@i2pmail.org>
This commit is contained in:
R4SAS 2020-11-10 21:37:43 +03:00
parent 9e580de53c
commit 6f91e3988c

View file

@ -29,36 +29,29 @@ namespace cpu
void Detect() void Detect()
{ {
__builtin_cpu_init();
#if defined(__AES__) || defined(__AVX__)
#if defined(__x86_64__) || defined(__i386__) #if defined(__x86_64__) || defined(__i386__)
__builtin_cpu_init();
int info[4]; int info[4];
__cpuid(0, info[0], info[1], info[2], info[3]); __cpuid(0, info[0], info[1], info[2], info[3]);
if (info[0] >= 0x00000001) { if (info[0] >= 0x00000001) {
__cpuid(0x00000001, info[0], info[1], info[2], info[3]); __cpuid(0x00000001, info[0], info[1], info[2], info[3]);
#ifdef __AES__
if (__builtin_cpu_supports("aes")) { if (__builtin_cpu_supports("aes")) {
aesni = info[2] & bit_AES; // AESNI aesni = info[2] & bit_AES; // AESNI
} }
#endif // __AES__
if (__builtin_cpu_supports("avx")) { if (__builtin_cpu_supports("avx")) {
avx = info[2] & bit_AVX; // AVX avx = info[2] & bit_AVX; // AVX
} }
} }
#endif // defined(__x86_64__) || defined(__i386__) #endif // defined(__x86_64__) || defined(__i386__)
#ifdef __AES__
if(aesni) if(aesni)
{ {
LogPrint(eLogInfo, "AESNI enabled"); LogPrint(eLogInfo, "AESNI enabled");
} }
#endif // __AES__
if(avx) if(avx)
{ {
LogPrint(eLogInfo, "AVX enabled"); LogPrint(eLogInfo, "AVX enabled");
} }
#endif // defined(__AES__) || defined(__AVX__)
} }
} }
} }