Re: Comparisons and Operations on BigEndianLong
Re: Comparisons and Operations on BigEndianLong
- Subject: Re: Comparisons and Operations on BigEndianLong
- From: James Meiss <email@hidden>
- Date: Sun, 24 Sep 2006 14:57:11 -0600
On 22/09/2006, at 9:59 AM, 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'."
.....
I thought that this code (taken from some Apple example ages ago)
worked just fine (though my intel machine went away, so I can't check
it just now).
Am I wrong?
//A few keyboard scan codes
#define SHIFT 0x38
#define OPTION 0x3A
#define SPACE 0x31
#define ENTER 0x4C
#define RETURN 0x24
#define PERIOD 0x2F
#define COMMAND 0x37
#define CKEY 0x08
short isPressed(unsigned short k ) // k = any keyboard scan code, 0-127
{
KeyMap km;
GetKeys( km);
return ( ( ((unsigned char *)km)[k>>3] >> (k & 7) ) & 1);
}
I don't know if the casting is "a good idea"...probably it violates
some principle, and I don't have the guru-status to really understand
the binary ops.
--
James Meiss
<http://amath.colorado.edu/faculty/jdm>
_______________________________________________
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