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 14:18:06 -0400
How is that exactly? I've never heard of powerPC running in little
endian mode.
On May 17, 2006, at 10:53 AM, Shawn Erickson wrote:
On May 17, 2006, at 6:05 AM, Lee Falin wrote:
"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");
}
This is a little fragile since in theory PPC can run in either
endian mode.
-Shawn
_______________________________________________
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