Subject: coding issues
To: None <port-macppc@netbsd.org>
From: Brian Hechinger <wonko@4amlunch.net>
List: port-macppc
Date: 01/24/2005 07:38:42
ok, i'm trying to build some software, and i get this error:
image.c:197: error: invalid operands to binary >>
image.c:197: error: invalid operands to binary >>
image.c:197: error: invalid operands to binary >>
image.c:198: error: invalid operands to binary &
here is the offending code:
g = ( ((p >> 24) & 0xff) + ((p >> 16) & 0xff) + ((p >> 8) & 0xff)) / 3;
p = (g << 24) | (g << 16) | (g << 8) | (p & 0xff);
this works on the x86 platform (under both linux and netbsd) so this is
either and endian issue or an arch. issue. my C knowledge isn't great
enough to completely grasp these sorts of things, so i don't know the
proper way to fix this.
if this is a portability issue, is there a more portable way of doing this?
or will i have to do an '#ifdef NOT_INTEL' or '#ifdef MACPPC' and have it
done whichever way is better for each platform?
-brian
--
"Now you know why I got the everliving hell OUT of Windows administration.
Knowing it doesn't make it any easier. It's just broken-as-designed."