On 06/09/16 21:47, BALATON Zoltan wrote:
(and I can't see how anyone would implement memcpy() backwards as it would be extremely cache unfriendly). But feel free to point out sources that suggest otherwise :)
I can only point to documentation (e.g. man pages) that say that if memory regions are overlapping memcpy's behaviour is undefined but memmove is guaranteed to work so it's safer to use that for known overlapping regions. As in OpenBIOS we are using the built in implementations one can rely on the memcpy implementation but I think it's cleaner to use memmove here and not rely on something not guaranteed even if it happens to work.
So this works both ways here just looks better with memmove IMO. This is not a real problem with this patch just a suggestion.
Sleeping on this, I've reconsidered and decided to switch to memmove() since we can't guarantee that what happens to work now will always work in future.
I won't bother reposting the patchset again, but I've updated it in my local queue.
ATB,
Mark.