On Dec 12, 2007 6:00 PM, Carsten Sørensen <[EMAIL PROTECTED]> wrote: > On Dec 12, 2007 6:27 PM, Nuno Lucas <[EMAIL PROTECTED]> wrote: > > The thing is that not all CPU's "raise" an exception when doing an > > un-aligned access. Some just return the wrong value and don't give any > > sign that something wrong occurred. The check of the pointer alignment > > before every read access would kill any performance, even on fast > > CPU's (and we are talking of 200MHz CPU's here). > > > > I would just go for the memcpy() aproach. It will allow the CPU to > > optimize the best it can the copy operation. > > I would agree. memcpy() or read the individual bytes and shift them > around to form a 32 bit value. The original source is the problem, not > the compiler. Other people tend to agree, I've been googling a bit and > have come across this > http://lecs.cs.ucla.edu/wiki/index.php/XScale_alignment which might > help to identify similar (potential) problems in the source and > includes some useful suggestions on how to fix them.
LWN has a recent article on this also (though more kernel related): http://lwn.net/SubscriberLink/260832/3ac7dff2ecb9bd8f/ Regards, ~Nuno Lucas > Kind regards, > Carsten Sorensen ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ Cegcc-devel mailing list Cegcc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cegcc-devel