Skip to content

Commit

Permalink
Trim CPU name spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
ccomrade committed Sep 26, 2023
1 parent 43b7fb9 commit cee6fb7
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Code/Library/CPUID.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ struct CPUID
std::memcpy(this->brand_string + 16, &query, 16);
query = Query(0x80000004);
std::memcpy(this->brand_string + 32, &query, 16);

this->TrimSpaces(this->brand_string);
}
}

Expand All @@ -120,6 +122,30 @@ struct CPUID
{
return this->vendor == VENDOR_AMD && this->leaf_80000001_edx[31];
}

private:
void TrimSpaces(char* s)
{
char* begin = s;
char* end = s;

while (*s == ' ')
{
s++;
}

while (*s)
{
if (*s != ' ')
{
end = s + 1;
}

*begin++ = *s++;
}

*end = '\0';
}
};

extern const CPUID g_cpuid;

0 comments on commit cee6fb7

Please sign in to comment.