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: Heinrich Giesen <email@hidden>
- Date: Wed, 17 May 2006 18:24:45 +0200
Hi,
On May 17, 2006, at 1:57 PM, email@hidden wrote:
Does anyone know of a way to programmatically determine whether ones
Mac code is running on PowerPC or Intel hardware?
I have seen a lot of replies (not very satisfying). I think that the OP
is not really interested in the name of the cpu but more
in how it works: littleEndian or bigEndian. I first had to do with
this problem when OpenStep became fat. (because "fat" was not
politically correct it is now replaced with "universal". Sumo ringers
are not fat, they are universal.)
The only one authority who knows all about the endianess is the cpu
itself. You can ask the cpu with (or a similar code):
int i = 1;
char *p = (char *) &i;
endianess = (p[0] == 1) ? LITTLE_ENDIAN : BIG_ENDIAN;
Do not forget wikipedia:
http://en.wikipedia.org/wiki/Endianness
And have a look at Gulliver's travel by Jonathan Swift. He (Gulliver)
did only meet
people who were big enemies about the endianess (of eggs), he met
also bad
guys who were called "the yahoos".
greetings
Heinrich
--
Heinrich Giesen
email@hidden
_______________________________________________
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