diff options
-rw-r--r-- | 16.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -34,6 +34,16 @@ qreverse(void * base, size_t nmemb, size_t size) if (nmemb < 2) return; +#if 0 // This goes slower?!? + if (nmemb < BUFSIZ / size) { + char tmp[nmemb * size]; + memcpy(tmp, base, nmemb * size); + for (i = 0; i < nmemb; ++i) + memcpy(base + i * size, tmp + (nmemb - 1 - i) * size, size); + return; + } +#endif + for (i = 0, j = nmemb - 1; i < j; ++i, --j) qswap(base, size, i, j); } |