Subject: Re: coding issues
To: None <port-macppc@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-macppc
Date: 01/24/2005 12:56:02
> 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 &

> g = ( ((p >> 24) & 0xff)  + ((p >> 16) & 0xff) + ((p >> 8) & 0xff)) / 3;
> p = (g << 24) | (g << 16) | (g << 8) | (p & 0xff);

[another message]
> g is uint32 and p is a pointer of type uint32,

If p is a pointer of any kind, the code is not correct and ought to
draw warnings/errors anywhere.  Pointers need to be cast to an integral
type before they can be used with >> or & - and I have to question how
correct any supposedly-MI code that thinks it wants to do so is anyway,
since it indicates some fairly deep-rooted type confusion on the
coder's/designer's part.

If you can show me the whole containing function, including its
interface contract, I can offer an opinion as to the Right Thing.
Might want to do that off-list, though.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B