Actually, scratch that. Col.r, g, b are all ints. I used the 
static_cast<unsigned char> as a hack. Please, therefore, apply the original 
patch.

Angus



On Tuesday 23 January 2001 13:14,  Angus Leeming wrote:

> > > Can you do this by shifting instead, since that is what we really do.
> > We just removes the lower 8 bits.
> > 
> >                 col.r = xcol.red >> 8;
> 
> Never, ever use shift on portable code without thinking REALLY hard about 
> what you're doing. What about big/little endian machines?
> 
> Anyway, the two approaches achieve the same goal and my way will work 
> on all machines.
> 
> > btw. I think you still need the static cast to avoid warnings.
> > 
> >                 col.r = static_cast<unsigned char>(xcol.red >> 8);
> 
> Fair enough. How about:
> 
> col.r = static_cast<unsigned char>(xcol.red / 256);
> 
> Patch attached.
> Angus
> 

----------------------------------------
Content-Type: text/x-c; charset="us-ascii"; name="patch.preferences"
Content-Transfer-Encoding: base64
Content-Description: 
----------------------------------------

Reply via email to