svn commit: r334928 - head/lib/libc/stdlib

Konstantin Belousov kostikbel at gmail.com
Mon Jun 11 09:22:42 UTC 2018


On Mon, Jun 11, 2018 at 03:48:52PM +1000, Bruce Evans wrote:
> Change TYPE to unsigned char[sizeof(old TYPE)] and use memcpy() to assign
> the variables to fix this with small churn and without the pessimizations
> in this commit.  This gives portable code back to K&R1978 + memcpy(), and
> is as efficient as the above when the above works.  On x86, even gcc-3.3
> produces a load and store for memcpy(p, q, sizeof(register_t)) when p and
> q are void *.
> 
> Change TYPE to unsigned char[n] and use a single memcpy() without a loop
> to assign the variables to fix this with larger churn and with different
> (smaller?) pessimizations than in this commit.  Setup and initialization
> for this method is also simpler.  This uses the newfangled VLA feature,
> and since n is variable for qsort(), builtin memcpy() with length n
> doesn't work so well.
Either results in the unacceptable stack use.

I can limit the char[es] and memcpy to some value of es, but I do not
see a point.  I will not object if somebody decides to do it.


More information about the svn-src-all mailing list