mirror of
https://gitlab.com/80486DX2-66/gists
synced 2025-05-31 08:31:41 +05:30
cpuid_vendor_id.mod.c: don't waste 1 char
for convenience
This commit is contained in:
@@ -58,7 +58,7 @@ static inline void native_cpuid(unsigned int function_id, cpuid_t r) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define VENDOR_ID_LEN 13
|
#define VENDOR_ID_LEN 12
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FIXME: you have to make sure the vendor argument is at least lengthed
|
* FIXME: you have to make sure the vendor argument is at least lengthed
|
||||||
@@ -74,12 +74,13 @@ static inline void cpuid_vendor_id(char vendor[VENDOR_ID_LEN]) {
|
|||||||
((unsigned*) vendor)[0] = v[EBX];
|
((unsigned*) vendor)[0] = v[EBX];
|
||||||
((unsigned*) vendor)[1] = v[EDX];
|
((unsigned*) vendor)[1] = v[EDX];
|
||||||
((unsigned*) vendor)[2] = v[ECX];
|
((unsigned*) vendor)[2] = v[ECX];
|
||||||
vendor[VENDOR_ID_LEN - 1] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
char vendor_string[VENDOR_ID_LEN];
|
char vendor_string[VENDOR_ID_LEN];
|
||||||
cpuid_vendor_id(vendor_string);
|
cpuid_vendor_id(vendor_string);
|
||||||
printf("CPU Vendor ID: '%s'\n", vendor_string);
|
fputs("CPU Vendor ID: '", stdout);
|
||||||
|
fwrite(vendor_string, sizeof(char), 12, stdout);
|
||||||
|
fputs("'\n", stdout);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user