Hi,

> threading, so couldn't cope with more than one request. I only really
> need to know the syntax to recreate the packed structures. Unless the
> structures are packed by default in SDCC.

Structures are packed by default by sdcc. Why should they not be? We are
talking about 8-bit micro, aligning data items to anything other than 1
byte boundaries is (usually) useless. Bits are packed into bytes as
proposed (it is a bit vague here) by the standard:

struct {
        int a;
        int b1:1;
        int b2:1;
        int b3:1;
           int :0;  /* required, at least with the pic16 port ... */
        /* compiler will pad with 5 bits here */
        char c;
} s = { 0x1122, 0, 1, 1, 0x55 };

will yield (from low to high addresses)
|0x22|0x11|0x06|0x55|
     a    a'   b    c
LSB first, bits filling the bytes LSb first, padding inserted only after
incompletely filled bytes.
Bitfields spanning multiple bytes or crossing byte boundaries, such as
struct {
     int r:5;
     int g:6;
     int b:5;
} rgb = { 1, 2, 3 };
do not work (at least with the pic ports).

Hope that helps,
Raphael

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to