This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Use memcpy in memmove when possible


Definitely do not insert an extra RETURN (dest).  There's no reason for that.

You should use tail calls for the memcpy invocations.  i.e.
	return memcpy (dest, src, len);

To avoid more #if nonsense for the bcopy case, write:
	dest = memcpy (dest, src, len);

Then the compiler ought to turn it into the tail call (but verify that).

Is there really ever going to be a case for MEMCPY_OK_FOR_BWD_MEMMOVE?
That is, will there ever be an implementation of memcpy that works for the
overlapping case but not the nonoverlapping case?  I can't really imagine
one.  If there isn't, then any case that would define your
MEMCPY_OK_FOR_BWD_MEMMOVE macro should really just be making memmove an
alias for memcpy instead.


Thanks,
Roland


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]