[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: General gcc4.0 porting guide





Ignacio Vazquez-Abrams wrote:
On Fri, 2005-04-29 at 15:32 +0200, Matthias Saou wrote:

Hmmm, so I guess the patch I've made for libmpeg3 is wrong. What would the
proper fix for this be, then?

     *((unsigned short*)data)++ = \
              ((CLIP(r_l) & 0xf8) << 8) | \
              ((CLIP(g_l) & 0xfc) << 3) | \
              ((CLIP(b_l) & 0xf8) >> 3);


Possibly:

      *((unsigned short*)data) = \
               ((CLIP(r_l) & 0xf8) << 8) | \
               ((CLIP(g_l) & 0xfc) << 3) | \
               ((CLIP(b_l) & 0xf8) >> 3);
      data += sizeof(unsigned short) / sizeof(*data);

or:

      register unsigned short newdata = \
               ((CLIP(r_l) & 0xf8) << 8) | \
               ((CLIP(g_l) & 0xfc) << 3) | \
               ((CLIP(b_l) & 0xf8) >> 3);
      data++ = (unsigned char)((newdata >> 8) & 0xff);
      data++ = (unsigned char)(newdata & 0xff);


this assumes MSB endianness (so won't work on intel) and that data is a (unsigned) char *, which has not been stated. Also you probably mean "*data++ =" not "data++ ="


Regards,


Hans



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]