@@ -13,14 +13,33 @@ using std::endl;
1313#include " x86/cpu_x86.h"
1414using namespace FeatureDetector ;
1515
16- int main (){
16+ void WriteFeature (bool feature, char * visual, bool &has)
17+ {
18+ if (feature)
19+ {
20+ if (has) { cout << " , " ; }
21+ cout << visual;
22+ has = true ;
23+ }
24+ }
1725
18- cout << " CPU Vendor String: " << cpu_x86::get_vendor_string () << endl;
19- cout << endl;
26+ int main (){
2027
21- cpu_x86::print_host ();
28+ // detect CPU features
29+ cpu_x86 features;
30+ features.detect_host ();
2231
23- #if _WIN32
24- system (" pause" );
25- #endif
32+ // output main CPU features
33+ cout << " Features: " ;
34+ bool has = false ;
35+ WriteFeature (features.HW_MMX , " MMX" , has);
36+ WriteFeature (features.HW_SSE , " SSE" , has);
37+ WriteFeature (features.HW_SSE2 , " SSE2" , has);
38+ WriteFeature (features.HW_SSE42 , " SSE42" , has);
39+ WriteFeature (features.HW_AES , " AES" , has);
40+ WriteFeature (features.HW_SHA , " SHA" , has);
41+ WriteFeature (features.HW_AVX && features.OS_AVX , " AVX" , has);
42+ WriteFeature (features.HW_AVX2 && features.OS_AVX , " AVX2" , has);
43+ WriteFeature (features.HW_AVX512_F && features.OS_AVX512 , " AVX512" , has);
44+ cout << endl;
2645}
0 commit comments