for built-ins gcc takes into account alignement.
So, if gcc knows, that something aligned by 2 it uses world operations,
otherwise byte ones.

Packed does not mean the structure misaligned.
It depends on data types of the structure.
For example:

struct {
        char a;
        int b;
};

isn't aligned by world boundary.

struct { int a,b}
aligned.

Even more -- if the structure aligned and its size is not even, gcc will use 
world operations for thhis structure size()-1 and byte operation for a last 
byte of it.

cheers,
~d



On Monday 02 February 2004 15:56, G Halkes wrote:
> The documentation for the msp430 libc mentions a
> problem with memcpy where you copy 2 bytes. This
> problem is caused because the compiler does not take
> the alignment into account when using a builtin for
> this function. Also, when you use structs with the
> attribute 'packed' (causing the data to be misaligned)
> you get problems. These can all be solved by setting
> the STRICT_ALIGNMENT flag.

-- 
/*****************************************************************
     ("`-''-/").___..--''"`-._     (\   Dimmy the Wild     UA1ACZ
      `6_ 6  )   `-.  (     ).`-.__.`)  State Polytechnical Univ.
      (_Y_.)'  ._   )  `._ `. ``-..-'   Radio-Physics Departament
    _..`--'_..-_/  /--'_.' ,'           Saint Petersburg,  Russia
   (il),-''  (li),'  ((!.-'             +7 (812) 5403923, 5585314
 *****************************************************************/


Reply via email to