diff options
Diffstat (limited to 'benchtests/bench-memccpy.c')
-rw-r--r-- | benchtests/bench-memccpy.c | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/benchtests/bench-memccpy.c b/benchtests/bench-memccpy.c index 6dca16b..d3a2df5 100644 --- a/benchtests/bench-memccpy.c +++ b/benchtests/bench-memccpy.c @@ -20,28 +20,8 @@ #define TEST_NAME "memccpy" #include "bench-string.h" -void *simple_memccpy (void *, const void *, int, size_t); -void *stupid_memccpy (void *, const void *, int, size_t); - -IMPL (stupid_memccpy, 0) -IMPL (simple_memccpy, 0) -IMPL (memccpy, 1) - -void * -simple_memccpy (void *dst, const void *src, int c, size_t n) -{ - const char *s = src; - char *d = dst; - - while (n-- > 0) - if ((*d++ = *s++) == (char) c) - return d; - - return NULL; -} - void * -stupid_memccpy (void *dst, const void *src, int c, size_t n) +generic_memccpy (void *dst, const void *src, int c, size_t n) { void *p = memchr (src, c, n); @@ -52,6 +32,9 @@ stupid_memccpy (void *dst, const void *src, int c, size_t n) return NULL; } +IMPL (memccpy, 1) +IMPL (generic_memccpy, 0) + typedef void *(*proto_t) (void *, const void *, int c, size_t); static void |