• 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: Comparisons and Operations on BigEndianLong
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Comparisons and Operations on BigEndianLong


  • Subject: Re: Comparisons and Operations on BigEndianLong
  • From: Steve Christensen <email@hidden>
  • Date: Thu, 21 Sep 2006 15:21:52 -0700

On Sep 21, 2006, at 2:59 PM, Jeff Birac wrote:

I'm a newbie to Universal development. How do I deal (universally) with BigEndianLong values?

The following code (compiled fine for PPC) is meant to check if the Shift key is pressed. But the compiler (for i386) complains "error: no match for 'operator&' in 'theKeys[1] & 1'."

Boolean IsShiftKeyPressed()
{
  KeyMap  theKeys;

  ::GetKeys( theKeys );

  if ( theKeys[1] & 0x01 )
  {
    return( true );
  }

  return( false );
}

[snip]

Why not just do this instead? You should read the comments in Events.h and CarbonEventsCore.h on how these functions behave. If you're just checking while your application is active, you'll only need to use the last part.


Boolean IsShiftKeyPressed()
{
// if the application is inactive, get the current state from the window server
// (this is more expensive since it has to go out to the hardware)
if (!applicationIsActive)
return ((GetCurrentKeyModifiers() & shiftKey) != 0);


    // use the event queue-synchronized keyboard modifier state
    return ((GetCurrentEventKeyModifiers() & shiftKey) != 0);
}

_______________________________________________
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


References: 
 >Comparisons and Operations on BigEndianLong (From: Jeff Birac <email@hidden>)

  • Prev by Date: Re: Comparisons and Operations on BigEndianLong
  • Next by Date: "Open quickly" files in search paths ??
  • Previous by thread: Re: Comparisons and Operations on BigEndianLong
  • Next by thread: Re: Comparisons and Operations on BigEndianLong
  • Index(es):
    • Date
    • Thread