General gcc4.0 porting guide

Enrico Scholz enrico.scholz at informatik.tu-chemnitz.de
Fri Apr 29 14:10:20 UTC 2005


thias at spam.spam.spam.spam.spam.spam.spam.egg.and.spam.freshrpms.net (Matthias Saou) writes:

>> >>((short int*)foo)++;  // gcc4 does not like this.
>> ...
>> Correct would be:
>> foo = (int *)((short int *)foo + 1);
>
> 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);

When this happens in a loop, I would write:

| uint16_t  *data_c = (uint16_t *)(data);
| 
| for (....) {
|     ...
|     *data_c++ = ((CLIP...));    // FIXME: what's about endianess?
| }
| 
| data = (uint32_t *)(data_c);    // FIXME: what's about aligment??


But it would be much better, to use a fitting datastructure for 'data'
instead of a plain uint32_t[]. But that's an upstream but not packager
task.




Enrico
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 480 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-extras-list/attachments/20050429/75b1496c/attachment.sig>


More information about the fedora-extras-list mailing list