Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Glib byte-swapping macros on Intel and PPC
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Glib byte-swapping macros on Intel and PPC



I can't find any gconfig.h, so it seems like it is called glibconfig.h now.

Well, I'm going to try to build a pure PPC configuration to see what the glibconfig.h is. In the meantime, if anyone has built glib on a PPC, I would like to get a copy of your glibconfig.h

I'm guessing that the macros will be changed around a bit so that this:

#define GUINT16_TO_LE(val) ((guint16) (val))
#define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val))

becomes this:

#define GUINT16_TO_LE(val) (GUINT16_SWAP_LE_BE (val))
#define GUINT16_TO_BE(val) ((guint16) (val))

Thanks to all - for the help!

On 4-Oct-07, at 10/04/07 4:25 PM, Greg Parker wrote:

Ryan Homer wrote:
I've built a Universal version of the glib library and am trying to get libmimic to work properly for the PPC architecture (works fine for Intel arch). I'm on an Intel platform and testing under Rosetta.

In particular, I'm confused with how the byte-swapping macros are supposed to work. Take GUINT16_FROM_LE as an example. In particular, a line of code from libmimic that uses this macro is:

    width  = GUINT16_FROM_LE(*((guint16 *) (frame_buffer + 4)));

Now here are the definitions of the macros involved:

gtypes.h
#define GUINT16_FROM_LE(val) (GUINT16_TO_LE (val))

gconfig.h
#define GUINT16_TO_LE(val) ((guint16) (val))

gconfig.h (aka glibconfig.h in current glib, I assume) is generated by the configure script, which detects only one architecture and only generates headers for that architecture. I'm guessing that your universal glib contains only the gconfig.h that was generated by the Intel configure/build, and if you ran a ppc configure you'd get a different definition.

In order to build your universal glib, you'll need to modify the architecture-specific headers like gconfig.h so that they contain code for all architectures, protected by appropriate #ifdef checks.


-- 
Greg Parker     email@hidden     Runtime Wrangler



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Unix-porting mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.