forked from microsoft/VCSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.cpp
40 lines (36 loc) · 1.13 KB
/
test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <stdio.h>
#include "cpuid.h"
void expand(int avail, int mask)
{
if (mask & _CPU_FEATURE_MMX) {
printf("\t%s\t_CPU_FEATURE_MMX\n",
avail & _CPU_FEATURE_MMX ? "yes" : "no");
}
if (mask & _CPU_FEATURE_SSE) {
printf("\t%s\t_CPU_FEATURE_SSE\n",
avail & _CPU_FEATURE_SSE ? "yes" : "no");
}
if (mask & _CPU_FEATURE_SSE2) {
printf("\t%s\t_CPU_FEATURE_SSE2\n",
avail & _CPU_FEATURE_SSE2 ? "yes" : "no");
}
if (mask & _CPU_FEATURE_3DNOW) {
printf("\t%s\t_CPU_FEATURE_3DNOW\n",
avail & _CPU_FEATURE_3DNOW ? "yes" : "no");
}
}
void main(void)
{
_p_info info;
_cpuid(&info);
printf("v_name:\t\t%s\n", info.v_name);
printf("model:\t\t%s\n", info.model_name);
printf("family:\t\t%d\n", info.family);
printf("model:\t\t%d\n", info.model);
printf("stepping:\t%d\n", info.stepping);
printf("feature:\t%08x\n", info.feature);
expand(info.feature, info.checks);
printf("os_support:\t%08x\n", info.os_support);
expand(info.os_support, info.checks);
printf("checks:\t\t%08x\n", info.checks);
}