Skip to content
Snippets Groups Projects
Unverified Commit 9cd3b3bb authored by fireice-uk's avatar fireice-uk Committed by GitHub
Browse files

Merge pull request #2294 from psychocrypt/fix-aesDetection

fix avx detection
parents e1527d98 2739e435
No related branches found
No related tags found
No related merge requests found
...@@ -37,9 +37,9 @@ namespace cpu ...@@ -37,9 +37,9 @@ namespace cpu
{ {
int32_t mask = 1 << bit; int32_t mask = 1 << bit;
return (val & mask) != 0u; return (val & mask) != 0u;
} }
Model getModel() Model getModel()
{ {
int32_t cpu_info[4]; int32_t cpu_info[4];
...@@ -53,7 +53,7 @@ namespace cpu ...@@ -53,7 +53,7 @@ namespace cpu
Model result; Model result;
cpuid(1, 0, cpu_info); cpuid(1, 0, cpu_info);
result.family = get_masked(cpu_info[0], 12, 8); result.family = get_masked(cpu_info[0], 12, 8);
result.model = get_masked(cpu_info[0], 8, 4) | get_masked(cpu_info[0], 20, 16) << 4; result.model = get_masked(cpu_info[0], 8, 4) | get_masked(cpu_info[0], 20, 16) << 4;
result.type_name = cpustr; result.type_name = cpustr;
...@@ -63,8 +63,8 @@ namespace cpu ...@@ -63,8 +63,8 @@ namespace cpu
result.sse2 = has_feature(cpu_info[3], 26); result.sse2 = has_feature(cpu_info[3], 26);
// aes-ni // aes-ni
result.aes = has_feature(cpu_info[2], 25); result.aes = has_feature(cpu_info[2], 25);
// avx // avx - 27 is the check if the OS overwrote cpu features
result.avx = has_feature(cpu_info[2], 28); result.avx = has_feature(cpu_info[2], 28) && has_feature(cpu_info[2], 27) ;
if(strcmp(cpustr, "AuthenticAMD") == 0) if(strcmp(cpustr, "AuthenticAMD") == 0)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment