Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Still struggling with Universal Binaries



I personally haven't been able to verify my code on an Intel machine (I don't have or have access to one) but a report from a beta tester stated that the function that uses the #if/#else didn't operate the same way as expected. This is the only reason I didn't think it was working fine.

Perhaps it's a user error instead ... or simply an error on my part elsewhere.

Aram

On Jan 31, 2006, at 7:38 PM, John Stiles wrote:

What made you think __BIG_ENDIAN__ would not work? We use it for lots of things.
(There is also __ppc__ for non-endian issues, like assembly.)



On Jan 31, 2006, at 4:29 PM, Aram Kudurshian wrote:

I posted a while back ago about converting a method I had to work with universal binaries and had thought that the following code would have solved the issue. Turns out I was wrong and now, re- reading information online, I'm wondering if the only reason this compiled is because Xcode simply ignored what was contained in the #else as I was compiling on a PowerPC machine.

So, can anyone point me in the right direction of converting my one and only function that fails to work with Intel machines? Is there no way to simply say, look ... if it's a PPC machine, execute this code but if it's an intel one, go ahead and grab the big endian value and then execute the code.

Thanks,
	Aram

- (BOOL) allKeysPressed:(int)inMask {
	
    KeyMap theKeys;
    GetKeys(theKeys);
	
	#if defined(__BIG_ENDIAN__)

return (((theKeys[1] & 0x0008) ? 1 : 0) == ((inMask & kHPControlModifierKey) ? 1 : 0)) &&
(((theKeys[1] & 0x0004) ? 1 : 0) == ((inMask & kHPOptionModifierKey ) ? 1 : 0)) &&
(((theKeys[1] & 0x0001) ? 1 : 0) == ((inMask & kHPShiftModifierKey ) ? 1 : 0)) &&
(((theKeys[1] & 0x8000) ? 1 : 0) == ((inMask & kHPCommandModifierKey) ? 1 : 0));

#else

return (((theKeys[1].bigEndianValue & 0x0008) ? 1 : 0) == ((inMask & kHPControlModifierKey) ? 1 : 0)) &&
(((theKeys[1].bigEndianValue & 0x0004) ? 1 : 0) == ((inMask & kHPOptionModifierKey ) ? 1 : 0)) &&
(((theKeys[1].bigEndianValue & 0x0001) ? 1 : 0) == ((inMask & kHPShiftModifierKey ) ? 1 : 0)) &&
(((theKeys[1].bigEndianValue & 0x8000) ? 1 : 0) == ((inMask & kHPCommandModifierKey) ? 1 : 0));
#endif


}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jstiles% 40blizzard.com


This email sent to 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: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Still struggling with Universal Binaries (From: Aram Kudurshian <email@hidden>)
 >Re: Still struggling with Universal Binaries (From: John Stiles <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.