[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0811190919280.27671@anakin>
Date: Wed, 19 Nov 2008 09:21:48 +0100 (CET)
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Andrew Morton <akpm@...ux-foundation.org>
cc: mm-commits@...r.kernel.org, harvey.harrison@...il.com,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
bryan.wu@...log.com, "David S. Miller" <davem@...emloft.net>,
dhowells@...hat.com, Greg Ungerer <gerg@...inux.org>,
grundler@...isc-linux.org, heiko.carstens@...ibm.com,
hskinnemoen@...el.com, ink@...assic.park.msu.ru, kyle@...artin.ca,
lethal@...ux-sh.org, linux-arch@...r.kernel.org, mingo@...e.hu,
Paul Mackerras <paulus@...ba.org>,
Ralf Baechle <ralf@...ux-mips.org>,
Russell King <rmk@....linux.org.uk>, rth@...ddle.net,
schwidefsky@...ibm.com, takata@...ux-m32r.org, tglx@...utronix.de,
tony.luck@...el.com, ysato@...rs.sourceforge.jp,
zankel@...silica.com, Roman Zippel <zippel@...ux-m68k.org>,
Linux Kernel Development <linux-kernel@...r.kernel.org>
Subject: Re: + unaligned-introduce-common-header.patch added to -mm tree
On Tue, 18 Nov 2008, akpm@...ux-foundation.org wrote:
> Subject: unaligned: introduce common header
> From: Harvey Harrison <harvey.harrison@...il.com>
>
> There are two common cases in the kernel, one where unaligned access is OK
> for an arch and one where the arch uses a packed-struct for the native
> endianness and opencoded C byteshifting for the other endianness.
> Consolidate these two implementations in asm-generic/unaligned.h
>
> Arches that require no special handling of unaligned access can define
> _UNALIGNED_ACCESS_OK in their asm/unaligned.h before including the generic
> version.
>
> +static inline void __put_le32_noalign(u8 *p, u32 val)
> +{
> + __put_le16_noalign(p + 2, val >> 16);
> + __put_le16_noalign(p, val);
Isn't it more logical to reverse the order, to store in increasing memory
locations:
__put_le16_noalign(p, val);
__put_le16_noalign(p + 2, val >> 16);
> +}
> +
> +static inline void __put_le64_noalign(u8 *p, u64 val)
> +{
> + __put_le32_noalign(p + 4, val >> 32);
> + __put_le32_noalign(p, val);
Same here:
__put_le32_noalign(p, val);
__put_le32_noalign(p + 4, val >> 32);
> +}
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists