mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Common: Expose CPU extension list directly.
A bit silly to rely on the specific string formatting of a summary.
This commit is contained in:
1 parent
368aba3c8d
commit
09eb509df4
7 files changed
+168
-62
No files matched your search
@@ -176,18 +176,45 @@ void CPUInfo::Detect()
|
||||
RiscV_B = ExtensionSupported(hwcap, 'B');
|
||||
}
|
||||
|
||||
std::vector<std::string> CPUInfo::Features() {
|
||||
std::vector<std::string> features;
|
||||
|
||||
struct Flag {
|
||||
bool &flag;
|
||||
const char *str;
|
||||
};
|
||||
const Flag list[] = {
|
||||
{ RiscV_M, "Muldiv" },
|
||||
{ RiscV_A, "Atomic" },
|
||||
{ RiscV_F, "Float" },
|
||||
{ RiscV_D, "Double" },
|
||||
{ RiscV_C, "Compressed" },
|
||||
{ RiscV_V, "Vector" },
|
||||
{ RiscV_B, "Bitmanip" },
|
||||
{ CPU64bit, "64-bit" },
|
||||
};
|
||||
|
||||
for (auto &item : list) {
|
||||
if (item.flag) {
|
||||
features.push_back(item.str);
|
||||
}
|
||||
}
|
||||
|
||||
return features;
|
||||
}
|
||||
|
||||
// Turn the cpu info into a string we can show
|
||||
std::string CPUInfo::Summarize()
|
||||
{
|
||||
std::string CPUInfo::Summarize() {
|
||||
std::string sum;
|
||||
if (num_cores == 1)
|
||||
sum = StringFromFormat("%s, %i core", cpu_string, num_cores);
|
||||
else
|
||||
sum = StringFromFormat("%s, %i cores", cpu_string, num_cores);
|
||||
if (CPU64bit) sum += ", 64-bit";
|
||||
|
||||
//TODO: parse "isa : rv64imafdc" from /proc/cpuinfo
|
||||
|
||||
auto features = Features();
|
||||
for (std::string &feature : features) {
|
||||
sum += ", " + feature;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user