On Thu, May 24, 2012 at 09:04:27AM -0700, Linus Torvalds wrote: > On Wed, May 23, 2012 at 8:34 PM, David Miller <davem@xxxxxxxxxxxxx> wrote: > > - > > +#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS > > ? ? ? ?if (((long) dst | (long) src) & (sizeof(long) - 1)) > > ? ? ? ? ? ? ? ?goto byte_at_a_time; > > +#endif > > +#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS > > ?byte_at_a_time: > > +#endif > > Btw, this would have been much cleaner with something like > > #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS > #define IS_UNALIGNED(src,dst) 0 > #else > #define IS_UNALIGNED(src,dst) (((long)(src) | (long)(dst)) & > (sizeof(long) - 1)) > #endif > > and then just > > if (IS_UNALIGNED(src,dst)) > goto byte_at_a_time; > > in the source code. Those #ifdef's in the middle of the code really > are horribly ugly, and are unnecessary. > > Besides, some architecture may actually have ok unaligned loads, and > just horrible unaligned stores, and it would be easier with that kind > of abstraction. > SH-4A processors fall under this. All of them support efficient 32-bit unaligned loads but no stores at all or loads of any other size. Having said that, the compiler isn't exactly brilliant at figuring out when to emit them, so I'd probably still have to do it by hand. -- To unsubscribe from this list: send the line "unsubscribe linux-arch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html