Now if you want to do it properly so its portable the correct way is to use uintptr_t for the translation and C99 dot format
This allows you move the pointer anywhere within the struct and it sets correctly
In C99, uintptr_t will put some safety around your code because it is defined as
an unsigned integer type with the property that any valid pointer to void can be converted to this type, then converted back to pointer to void, and the result will compare equal to the original pointer
Then someone who has AMD processor could take a look on that location and tell me what value has PROCESSOR_IDENTIFIER key (on location: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment)
OK, last try: what actual problem are you trying to resolve? Knowing whether it is AMD or Intel will not make any difference to the execution of your application, so I can only assume that you have found some other issue which you are keeping secret from us.
Richard, I am sorry if I was evasive ... Thank you for your patience.
I am working on some code which execute some depending of what kind of processor:
BOOL bIsIntel = FALSE;
bIsIntel = (si.wProcessorArchitecture == xxx);
// execute some code (I cannot write here what kind of code)
// execute else code
Furthermore, the code is critical as speed of execution. So, I noticed that GetSystemInfo is taking a time, specially on older machines. So, I intend to retrieve from registry if the machine is AMD or Intel. That is all. I am not hiding anything. If I omitting anything, please tell me, and I will write here.
P.S. I don't have any AMD machine, or my colleagues ... if I would, I had tested myself.
That is most likely because it has to go to the registry to get the information. You have placed that code in the wrong place. It should be called once at the beginning of the program to set a global or class variable that can then be tested at processor speed.
However, the chances of you being able to adjust the speed of your code at the point you show is not very likely. The compiler will optimise any code as much as possible, and whichever processor executes that code will further optimise it through the use of its own pipelining mechanism. Your time would be better spent working on real problems.
You can find the vendor identifier with CPUID. The same mechanism can be used to find out what features the CPU supports, which is normally more useful than merely knowing the vendor, obviously it depends on what you want.
Last Visit: 20-Feb-20 5:28 Last Update: 20-Feb-20 5:28