Messages in this thread | | | Date | Thu, 20 Mar 2008 13:08:00 -0700 | From | "H. Peter Anvin" <> | Subject | Re: [RFC PATCH] kernel: add byteorder macros with alignment fixups |
| |
Harvey Harrison wrote: > A common pattern in the kernel (especially networking) is: > > le32_to_cpu(get_unaligned((__le32 *)x)); > > Repeat for various combinations of le/be and 64/32/16 bit. Add > a variant that operates on possibly unaligned pointers to > byteorder/generic.h >
This should go in <asm-generic/*> since on some architectures this can be done significantly faster than the chained pattern, since you can get the reordering for "free". Thus, architectures should be able to override the generic.
-hpa
| |