On 27 Jan 2009, at 14:23, Adam Venturella wrote:

The file I am
reading is assured to be in little-endian, and I am checking what the
host byte ordering is first.  Leopard is little endian ( at least on
the intel chips, but I have read there are other macs that are
big-endian, so I am trying to catch and handle that accordingly)

Adam: Repeating a comment from an earlier reply, you should just use the supplied functions in <Foundation/NSByteOrder.h>. They will work correctly whether you're building for a little-endian Intel processor or a big-endian PowerPC processor. Then you don't have to specifically "catch and handle" anything. So for your case of little- endian data being read from a file:

unsigned short NSSwapLittleShortToHost(unsigned short x);
unsigned int NSSwapLittleIntToHost(unsigned int x);
unsigned long NSSwapLittleLongToHost(unsigned long x);
unsigned long long NSSwapLittleLongLongToHost(unsigned long long x);
double NSSwapLittleDoubleToHost(NSSwappedDouble x);
float NSSwapLittleFloatToHost(NSSwappedFloat x);


steve

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to