Skip to content

Commit 675ba75

Browse files
authored
Merge pull request #581 from NotRequiem/dev
sync dev
2 parents 8fe8fb8 + 242c7bd commit 675ba75

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/vmaware.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1966,10 +1966,10 @@ struct VM {
19661966
};
19671967

19681968
// this forces the compiler to calculate the hash when initializing the array while staying C++11 compatible
1969-
struct Entry {
1969+
struct thread_entry {
19701970
u32 hash;
19711971
u32 threads;
1972-
constexpr Entry(const char* m, u32 t) : hash(ConstexprHash::get(m)), threads(t) {}
1972+
constexpr thread_entry(const char* m, u32 t) : hash(ConstexprHash::get(m)), threads(t) {}
19731973
};
19741974

19751975
enum class CpuType {
@@ -1979,7 +1979,7 @@ struct VM {
19791979
};
19801980

19811981
// 4 arguments to stay compliant with x64 __fastcall (just in case)
1982-
[[nodiscard]] static bool verify_thread_count(const Entry* db, size_t db_size, size_t max_model_len, CpuType type) {
1982+
[[nodiscard]] static bool verify_thread_count(const thread_entry* db, size_t db_size, size_t max_model_len, CpuType type) {
19831983
// to save a few cycles
19841984
struct hasher {
19851985
static u32 crc32_sw(u32 crc, char data) {
@@ -2671,7 +2671,7 @@ struct VM {
26712671
// umap is not an option because it cannot be constexpr
26722672
// constexpr is respected here even in c++ 11 and static solves stack overflow
26732673
// c arrays have less construction overhead than std::array
2674-
static constexpr util::Entry thread_database[] = {
2674+
static constexpr util::thread_entry thread_database[] = {
26752675
// i3 series
26762676
{ "i3-1000G1", 4 },
26772677
{ "i3-1000G4", 4 },
@@ -3630,7 +3630,7 @@ struct VM {
36303630

36313631
static constexpr size_t MAX_INTEL_MODEL_LEN = 16;
36323632

3633-
return util::verify_thread_count(thread_database, sizeof(thread_database) / sizeof(util::Entry), MAX_INTEL_MODEL_LEN, util::CpuType::INTEL_I);
3633+
return util::verify_thread_count(thread_database, sizeof(thread_database) / sizeof(util::thread_entry), MAX_INTEL_MODEL_LEN, util::CpuType::INTEL_I);
36343634
#endif
36353635
}
36363636

@@ -3648,7 +3648,7 @@ struct VM {
36483648
// umap is not an option because it cannot be constexpr
36493649
// constexpr is respected here even in c++ 11 and static solves stack overflow
36503650
// c arrays have less construction overhead than std::array
3651-
static constexpr util::Entry thread_database[] = {
3651+
static constexpr util::thread_entry thread_database[] = {
36523652
// Xeon D
36533653
{ "D-1518", 8 },
36543654
{ "D-1520", 8 },
@@ -3786,7 +3786,7 @@ struct VM {
37863786

37873787
static constexpr size_t MAX_XEON_MODEL_LEN = 16;
37883788

3789-
return util::verify_thread_count(thread_database, sizeof(thread_database) / sizeof(util::Entry), MAX_XEON_MODEL_LEN, util::CpuType::INTEL_XEON);
3789+
return util::verify_thread_count(thread_database, sizeof(thread_database) / sizeof(util::thread_entry), MAX_XEON_MODEL_LEN, util::CpuType::INTEL_XEON);
37903790
#endif
37913791
}
37923792

@@ -3803,7 +3803,7 @@ struct VM {
38033803
#else
38043804
// Database is reduced to identifying suffixes (last token of the original strings)
38053805
// for example handles "ryzen 5 3600" by matching "3600", which is unique in context
3806-
static constexpr util::Entry thread_database[] = {
3806+
static constexpr util::thread_entry thread_database[] = {
38073807
// 3015/3020
38083808
{ "3015ce", 4 },
38093809
{ "3015e", 4 },
@@ -4316,7 +4316,7 @@ struct VM {
43164316

43174317
static constexpr size_t MAX_AMD_MODEL_LEN = 24; // "threadripper" is long
43184318

4319-
return util::verify_thread_count(thread_database, sizeof(thread_database) / sizeof(util::Entry), MAX_AMD_MODEL_LEN, util::CpuType::INTEL_XEON);
4319+
return util::verify_thread_count(thread_database, sizeof(thread_database) / sizeof(util::thread_entry), MAX_AMD_MODEL_LEN, util::CpuType::INTEL_XEON);
43204320
#endif
43214321
}
43224322

0 commit comments

Comments
 (0)