[lkml]   [2007]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RFC] Documentation about unaligned memory access
On Fri, 23 Nov 2007 00:15:53 +0000 (GMT)
Daniel Drake <> wrote:

> Being spoilt by the luxuries of i386/x86_64 I've never really had a good
> grasp on unaligned memory access problems on other architectures and decided
> it was time to figure it out. As a result I've written this documentation
> which I plan to submit for inclusion as
> Documentation/unaligned_memory_access.txt
> Before I do so, any comments on the following?

A very nice, and much needed document. I think you should include one thing though:

memcpy() is _only_ safe when one of the pointers is char* or void*. If it is anything more complex than that, gcc will assume alignment and optimise based on that. E.g. memcpy() of two long:s generates the same assembly as doing an assignment.

(Technically it is no different for char* and void*, but since they have byte alignment, gcc can't really do anything creative.)

-- Pierre Ossman

Linux kernel, MMC maintainer
PulseAudio, core developer
rdesktop, core developer
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2007-11-24 15:27    [W:0.186 / U:0.608 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site