mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-29 04:07:49 +02:00
do not use builtin cpu detect, cpuid is enough
This commit is contained in:
parent
ad3bfcaaa5
commit
faf04def31
1 changed files with 2 additions and 5 deletions
|
@ -30,17 +30,14 @@ namespace cpu
|
||||||
void Detect(bool AesSwitch, bool AvxSwitch)
|
void Detect(bool AesSwitch, bool AvxSwitch)
|
||||||
{
|
{
|
||||||
#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 (info[2] & bit_AES && AesSwitch) {
|
||||||
if ((info[2] & bit_AES || __builtin_cpu_supports("aes")) && AesSwitch) {
|
|
||||||
aesni = true;
|
aesni = true;
|
||||||
}
|
}
|
||||||
#endif // __AES__
|
if (info[2] & bit_AVX && AvxSwitch) {
|
||||||
if ((info[2] & bit_AVX || __builtin_cpu_supports("avx")) && AvxSwitch) {
|
|
||||||
avx = true;
|
avx = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue