• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: GCC 4.0 GetKeys() and BigEndianLong for Intel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: GCC 4.0 GetKeys() and BigEndianLong for Intel
      • From: Ken Baer <email@hidden>
References: 
 >GCC 4.0 GetKeys() and BigEndianLong for Intel (From: Ken Baer <email@hidden>)
 >Re: GCC 4.0 GetKeys() and BigEndianLong for Intel (From: Eric Albert <email@hidden>)
 >Re: GCC 4.0 GetKeys() and BigEndianLong for Intel (From: Ken Baer <email@hidden>)

  • Prev by Date: Re: Predefined compiler symbols
  • Next by Date: Re: Bug in the objective-c++ compiler?
  • Previous by thread: Re: GCC 4.0 GetKeys() and BigEndianLong for Intel
  • Next by thread: Re: GCC 4.0 GetKeys() and BigEndianLong for Intel
  • Index(es):
    • Date
    • Thread