From 24fb0f88ed29d21b6034559e9c55545f22556bc0 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 26 Jul 2010 08:37:08 -0700 Subject: Add optimized x86-64 implementation of strnlen. While at it, beef up the test suite for strnlen and add performance tests for it, too. --- string/tst-strlen.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'string/tst-strlen.c') diff --git a/string/tst-strlen.c b/string/tst-strlen.c index a1e115927b..8cbe441975 100644 --- a/string/tst-strlen.c +++ b/string/tst-strlen.c @@ -31,11 +31,21 @@ main(int argc, char *argv[]) buf[words * 4 + 3] = (last & 8) != 0 ? 'e' : '\0'; buf[words * 4 + 4] = '\0'; - if (strlen (buf) != words * 4 + lens[last] - || strnlen (buf, -1) != words * 4 + lens[last]) + if (strlen (buf) != words * 4 + lens[last]) { - printf ("failed for base=%Zu, words=%Zu, and last=%Zu\n", - base, words, last); + printf ("\ +strlen failed for base=%Zu, words=%Zu, and last=%Zu (is %zd, expected %zd)\n", + base, words, last, + strlen (buf), words * 4 + lens[last]); + return 1; + } + + if (strnlen (buf, -1) != words * 4 + lens[last]) + { + printf ("\ +strnlen failed for base=%Zu, words=%Zu, and last=%Zu (is %zd, expected %zd)\n", + base, words, last, + strnlen (buf, -1), words * 4 + lens[last]); return 1; } } -- cgit v1.2.3