summaryrefslogtreecommitdiff
path: root/benchtests/bench-rawmemchr.c
diff options
context:
space:
mode:
Diffstat (limited to 'benchtests/bench-rawmemchr.c')
-rw-r--r--benchtests/bench-rawmemchr.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/benchtests/bench-rawmemchr.c b/benchtests/bench-rawmemchr.c
index 8664fe5107..d45a2b815d 100644
--- a/benchtests/bench-rawmemchr.c
+++ b/benchtests/bench-rawmemchr.c
@@ -1,5 +1,5 @@
/* Measure memchr functions.
- Copyright (C) 2013-2018 Free Software Foundation, Inc.
+ Copyright (C) 2013-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,33 +14,32 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
#include <assert.h>
+#include <stdint.h>
#define TEST_MAIN
#define TEST_NAME "rawmemchr"
#include "bench-string.h"
typedef char *(*proto_t) (const char *, int);
-char *simple_rawmemchr (const char *, int);
-
-IMPL (simple_rawmemchr, 0)
-IMPL (rawmemchr, 1)
char *
-simple_rawmemchr (const char *s, int c)
+generic_rawmemchr (const char *s, int c)
{
- while (1)
- if (*s++ == (char) c)
- return (char *) s - 1;
- return NULL;
+ if (c != 0)
+ return memchr (s, c, PTRDIFF_MAX);
+ return (char *)s + strlen (s);
}
+IMPL (rawmemchr, 1)
+IMPL (generic_rawmemchr, 0)
+
static void
do_one_test (impl_t *impl, const char *s, int c, char *exp_res)
{
- size_t i, iters = INNER_LOOP_ITERS;
+ size_t i, iters = INNER_LOOP_ITERS_LARGE * 4;
timing_t start, stop, cur;
char *res = CALL (impl, s, c);
if (res != exp_res)