lkml.org 
[lkml]   [2022]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86/boot: Avoid redundant address overlap tests in memcpy().
On 1/22/22 17:58, Kuniyuki Iwashima wrote:
> -void *memmove(void *dest, const void *src, size_t n)
> +void *____memmove(void *dest, const void *src, size_t n)
> {
> unsigned char *d = dest;
> const unsigned char *s = src;
>
> - if (d <= s || d - s >= n)
> - return ____memcpy(dest, src, n);
> -
> while (n-- > 0)
> d[n] = s[n];
>
> return dest;
> }

The ___ naming is pretty cruel. Could we call it memmove_no_overlap()
or memmove_unsafe()? Surely we can put some *useful* bytes in the name
rather than padding it out with _'s. No need to perpetuate the
____memcpy() naming.

Also, is this worth the churn? It probably saves less than 10
instructions, all of which are ridiculously cheap. Is there a *reason*
for this other than being a pure cleanup?

\
 
 \ /
  Last update: 2022-01-24 18:38    [W:0.045 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site