Re: GCC 4.0 GetKeys() and BigEndianLong for Intel
Re: GCC 4.0 GetKeys() and BigEndianLong for Intel
- Subject: Re: GCC 4.0 GetKeys() and BigEndianLong for Intel
- From: Eric Albert <email@hidden>
- Date: Wed, 15 Jun 2005 13:34:15 -0700
On Jun 15, 2005, at 12:01 PM, Ken Baer wrote: On Jun 15, 2005, at 11:03 AM, Eric Albert wrote: On Jun 15, 2005, at 10:29 AM, Ken Baer wrote: Anyway, when building for little-endian systems (#if __LITTLE_ENDIAN__), you should read the BigEndianLong value, use OSSwapBigToHostInt32 or the swapping function of your choice to put its field into a regular int, and then use it the way you otherwise would.
Thanks for the quick reply.
I still have an error though. Here's the code.
KeyMap theKeys; GetKeys( theKeys ); #if (__LITTLE_ENDIAN__) UInt32 keys = CFSwapInt32BigToHost( theKeys[1] ); #else UInt32 keys = theKeys[1]; #endif
The error I get is: error: cannot convert 'BigEndianLong' to 'uint32_t' for argument '1' to 'uint32_t CFSwapInt32BigToHost(uint32_t)'
Is there some other function I should be using for dealing with the BigEndianLong type?
Sorry I wasn't clear enough there. BigEndianLong is a long on PowerPC and a struct on Intel. Here's the Intel definition, from Endian.h:
struct BigEndianLong { long bigEndianValue; }; typedef struct BigEndianLong BigEndianLong;
So you want to swap theKeys[1].bigEndianValue on little-endian systems, not theKeys[1].
-Eric
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden