On Thu, 20 Apr 2000, Olaf Petzold wrote:

: >  The perfomance difference not so significant, rewriting critical paths in
: > asm is more effective usually. It should be noted that using 
: > -malign-double option can lead to different struct fields aligning, even
: > in the same app.
: 
: Oh dear... Can I avoid this by using 
: 
: typedef struct {
:   flag_t inuse;
:   flag_t valid;
:   double um[65536]
: }  __attribute__ ((aligned)) shm_slut_t;
: 
: ??? Is it guarantee that all structures (inside shm, inside local static copy,
: inside kernel space code produced by Gnu-C and user space program compiled by
: Gnu-C++) have the same aligment - even if compiled with the Option
: -align-double? Or could I use an explizit __attribute__ ((aligned (size))) .
: Which is a good size for those structures ??? __attribute__((packed)) is the
: safest way at moment, because they didn't have any aligment (I have have right
: read the gcc-info) but, it's a performance killer and I live from loock up
: tables (LUT) and performance (it's a controller task for magnetic bearing).

If you don't use ugly hacks like :

...
shm_slut_t t;
unsigned char *p = &t;
double *um = (double *)(p + sizeof(flag_t) * 2);
um[0] = 1.0;
...

all must be ok.
 
: 

                Rus


-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to