Re: programmatically determining if the machine is intel or not
Re: programmatically determining if the machine is intel or not
- Subject: Re: programmatically determining if the machine is intel or not
- From: Lee Falin <email@hidden>
- Date: Wed, 17 May 2006 09:05:56 -0400
"Does anyone know of a way to programmatically determine whether ones
Mac code is running on PowerPC or Intel hardware?"
An easy way to do this is to use the NSHostByteOrder function.
This will return the correct value for you for byte swapping purposes
as well. The problem with trying to just "read" the processor name as
some other posts have mentioned, is that those techniques don't take
Rosetta into account.
For example if your app is running on an Intel machine, but for some
reason the user, (or you for testing purposes) runs it in powerpc
mode under Rosetta, you would want it to report as running under
PowerPC rather than intel.
An example of how to do this:
if(NSHostByteOrder() == NS_BigEndian)
{
NSLog(@"is running in powerPC mode");
}
else
{
NSLog(@"is running in intel mode");
}
For more information, see the information at the developer transition
center: http://developer.apple.com/transition/
Hope that this helps
Lee
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden