@@ -1798,7 +1798,7 @@ struct VM {
17981798
17991799 // to search in our databases, we want to precompute hashes at compile time for C++11 and later
18001800 // so we need to match the hardware _mm_crc32_u8, it is based on CRC32-C (Castagnoli) polynomial
1801- struct ConstexprHash {
1801+ struct constexpr_hash {
18021802 // it does 8 rounds of CRC32-C bit reflection recursively
18031803 static constexpr u32 crc32_bits (u32 crc, int bits) {
18041804 return (bits == 0 ) ? crc :
@@ -1820,17 +1820,17 @@ struct VM {
18201820 struct thread_entry {
18211821 u32 hash;
18221822 u32 threads;
1823- constexpr thread_entry (const char * m, u32 t) : hash(ConstexprHash ::get(m)), threads(t) {}
1823+ constexpr thread_entry (const char * m, u32 t) : hash(constexpr_hash ::get(m)), threads(t) {}
18241824 };
18251825
1826- enum class CpuType {
1826+ enum class cpu_type {
18271827 INTEL_I,
18281828 INTEL_XEON,
18291829 AMD
18301830 };
18311831
18321832 // 4 arguments to stay compliant with x64 __fastcall (just in case)
1833- [[nodiscard]] static bool verify_thread_count (const thread_entry* db, size_t db_size, size_t max_model_len, CpuType type) {
1833+ [[nodiscard]] static bool verify_thread_count (const thread_entry* db, size_t db_size, size_t max_model_len, cpu_type type) {
18341834 // to save a few cycles
18351835 struct hasher {
18361836 static u32 crc32_sw (u32 crc, char data) {
@@ -1865,7 +1865,7 @@ struct VM {
18651865 std::string model_string;
18661866 const char * debug_tag = " " ;
18671867
1868- if (type == CpuType ::AMD) {
1868+ if (type == cpu_type ::AMD) {
18691869 if (!cpu::is_amd ()) {
18701870 return false ;
18711871 }
@@ -1883,7 +1883,7 @@ struct VM {
18831883 return false ;
18841884 }
18851885
1886- if (type == CpuType ::INTEL_I) {
1886+ if (type == cpu_type ::INTEL_I) {
18871887 if (!model.is_i_series ) {
18881888 return false ;
18891889 }
@@ -1947,7 +1947,7 @@ struct VM {
19471947 */
19481948
19491949 // convert to lowercase on-the-fly to match compile-time keys
1950- if (type == CpuType ::AMD && (k >= ' A' && k <= ' Z' )) k += 32 ;
1950+ if (type == cpu_type ::AMD && (k >= ' A' && k <= ' Z' )) k += 32 ;
19511951
19521952 // since this technique is cross-platform, we cannot use a standard C++ try-catch block to catch a missing CPU instruction
19531953 // we could use preprocessor directives and add an exception handler (VEH/SEH or SIGHANDLER) but nah
@@ -1964,7 +1964,7 @@ struct VM {
19641964 if (!next_is_alnum) {
19651965 // Check specific Z1 Extreme token
19661966 // Hash for "extreme" (CRC32-C) is 0x3D09D5B4
1967- if (type == CpuType ::AMD && current_hash == 0x3D09D5B4 ) { z_series_threads = 16 ; }
1967+ if (type == cpu_type ::AMD && current_hash == 0x3D09D5B4 ) { z_series_threads = 16 ; }
19681968
19691969 // since it's a contiguous block of integers in .rodata/.rdata, this is extremely fast
19701970 for (size_t idx = 0 ; idx < db_size; ++idx) {
@@ -1985,7 +1985,7 @@ struct VM {
19851985 }
19861986
19871987 // Z1 Extreme fix
1988- if (type == CpuType ::AMD && z_series_threads != 0 && expected_threads == 12 ) {
1988+ if (type == cpu_type ::AMD && z_series_threads != 0 && expected_threads == 12 ) {
19891989 expected_threads = z_series_threads;
19901990 }
19911991
@@ -3481,7 +3481,7 @@ struct VM {
34813481
34823482 static constexpr size_t MAX_INTEL_MODEL_LEN = 16 ;
34833483
3484- return util::verify_thread_count (thread_database, sizeof (thread_database) / sizeof (util::thread_entry), MAX_INTEL_MODEL_LEN, util::CpuType ::INTEL_I);
3484+ return util::verify_thread_count (thread_database, sizeof (thread_database) / sizeof (util::thread_entry), MAX_INTEL_MODEL_LEN, util::cpu_type ::INTEL_I);
34853485 #endif
34863486 }
34873487
@@ -3637,7 +3637,7 @@ struct VM {
36373637
36383638 static constexpr size_t MAX_XEON_MODEL_LEN = 16 ;
36393639
3640- return util::verify_thread_count (thread_database, sizeof (thread_database) / sizeof (util::thread_entry), MAX_XEON_MODEL_LEN, util::CpuType ::INTEL_XEON);
3640+ return util::verify_thread_count (thread_database, sizeof (thread_database) / sizeof (util::thread_entry), MAX_XEON_MODEL_LEN, util::cpu_type ::INTEL_XEON);
36413641 #endif
36423642 }
36433643
@@ -4167,7 +4167,7 @@ struct VM {
41674167
41684168 static constexpr size_t MAX_AMD_MODEL_LEN = 24 ; // "threadripper" is long
41694169
4170- return util::verify_thread_count (thread_database, sizeof (thread_database) / sizeof (util::thread_entry), MAX_AMD_MODEL_LEN, util::CpuType ::INTEL_XEON);
4170+ return util::verify_thread_count (thread_database, sizeof (thread_database) / sizeof (util::thread_entry), MAX_AMD_MODEL_LEN, util::cpu_type ::INTEL_XEON);
41714171 #endif
41724172 }
41734173
0 commit comments