Skip to content

Commit

Permalink
Merge pull request #2294 from psychocrypt/fix-aesDetection
Browse files Browse the repository at this point in the history
fix avx detection
  • Loading branch information
fireice-uk committed Mar 11, 2019
2 parents e1527d9 + 2739e43 commit 9cd3b3b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions xmrstak/backend/cpu/cpuType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ namespace cpu
{
int32_t mask = 1 << bit;
return (val & mask) != 0u;

}

Model getModel()
{
int32_t cpu_info[4];
Expand All @@ -53,7 +53,7 @@ namespace cpu
Model result;

cpuid(1, 0, cpu_info);

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.type_name = cpustr;
Expand All @@ -63,8 +63,8 @@ namespace cpu
result.sse2 = has_feature(cpu_info[3], 26);
// aes-ni
result.aes = has_feature(cpu_info[2], 25);
// avx
result.avx = has_feature(cpu_info[2], 28);
// avx - 27 is the check if the OS overwrote cpu features
result.avx = has_feature(cpu_info[2], 28) && has_feature(cpu_info[2], 27) ;

if(strcmp(cpustr, "AuthenticAMD") == 0)
{
Expand Down

0 comments on commit 9cd3b3b

Please sign in to comment.