misaligned read handling on various processors

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Oct 6 06:58:42 PDT 2009


Consider:

struct A {
     char a;
     align(1) int b;
}

Accesses to b will be rather slow because it's a misaligned read. My 
question is, how exactly is that handled on various processors? I seem 
to recall various anecdotes (including that misaligned reads on Intel 
cause a trap that does the needed double reading, shifting, and 
masking), but Google search has surprisingly little on the matter.


Thanks,

Andrei



More information about the Digitalmars-d mailing list