Date: Thu, 17 Dec 2009 21:10:04 GMT From: Maxim Zakharov <maxime@maxime.net.ru> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/141682: [libc] [patch] Faster version of strncpy(3) Message-ID: <200912172110.nBHLA4r3096739@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/141682; it has been noted by GNATS. From: Maxim Zakharov <maxime@maxime.net.ru> To: bug-followup@FreeBSD.org, maxime@maxime.net.ru Cc: Subject: Re: kern/141682: [libc] [patch] Faster version of strncpy(3) Date: Thu, 17 Dec 2009 23:46:03 +0300 Sorry, it seems one line was redundant: void * dps_strncpy(char *dst0, char *src0, size_t length) { if (length) { register size_t n = (length + 7) / 8; register size_t r = (length % 8); register char *dst = dst0, *src = src0; if (r == 0) r = 8; if (!(dst[0] = src[0])) return dst0; if (r > 1) if (!(dst[1] = src[1])) return dst0; if (r > 2) if (!(dst[2] = src[2])) return dst0; if (r > 3) if (!(dst[3] = src[3])) return dst0; if (r > 4) if (!(dst[4] = src[4])) return dst0; if (r > 5) if (!(dst[5] = src[5])) return dst0; if (r > 6) if (!(dst[6] = src[6])) return dst0; if (r > 7) if (!(dst[7] = src[7])) return dst0; src += r; dst += r; while (--n > 0) { if (!(dst[0] = src[0])) break; if (!(dst[1] = src[1])) break; if (!(dst[2] = src[2])) break; if (!(dst[3] = src[3])) break; if (!(dst[4] = src[4])) break; if (!(dst[5] = src[5])) break; if (!(dst[6] = src[6])) break; if (!(dst[7] = src[7])) break; src += 8; dst += 8; } } return dst0; } -- http://www.dataparksearch.org/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912172110.nBHLA4r3096739>