aboutsummaryrefslogtreecommitdiff
path: root/benchtests/bench-memcmp.c
diff options
context:
space:
mode:
authorNoah Goldstein <goldstein.w.n@gmail.com>2021-10-23 01:36:30 -0400
committerNoah Goldstein <goldstein.w.n@gmail.com>2021-10-27 13:03:46 -0500
commitcf3acd774f4c11e90cdc28192d69c60e2c02a004 (patch)
tree19d1e9a8408168c452d37d4f1a09a259d3762e52 /benchtests/bench-memcmp.c
parent3592ccd472a47ec8be977b0ff33f841f4c175caf (diff)
downloadglibc-cf3acd774f4c11e90cdc28192d69c60e2c02a004.tar
glibc-cf3acd774f4c11e90cdc28192d69c60e2c02a004.tar.gz
glibc-cf3acd774f4c11e90cdc28192d69c60e2c02a004.tar.bz2
glibc-cf3acd774f4c11e90cdc28192d69c60e2c02a004.zip
Benchtests: Add benchtests for __memcmpeq
No bug. This commit adds __memcmpeq benchmarks. The benchmarks just use the existing ones in memcmp. This will be useful for testing implementations of __memcmpeq that do not just alias memcmp.
Diffstat (limited to 'benchtests/bench-memcmp.c')
-rw-r--r--benchtests/bench-memcmp.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/benchtests/bench-memcmp.c b/benchtests/bench-memcmp.c
index 0d6a93bf29..2cf65525bb 100644
--- a/benchtests/bench-memcmp.c
+++ b/benchtests/bench-memcmp.c
@@ -17,17 +17,21 @@
<https://www.gnu.org/licenses/>. */
#define TEST_MAIN
-#ifdef WIDE
+#ifdef TEST_MEMCMPEQ
+# define TEST_NAME "__memcmpeq"
+# define SIMPLE_MEMCMP simple_memcmpeq
+#elif defined WIDE
# define TEST_NAME "wmemcmp"
+# define SIMPLE_MEMCMP simple_wmemcmp
#else
# define TEST_NAME "memcmp"
+# define SIMPLE_MEMCMP simple_memcmp
#endif
#include "bench-string.h"
#ifdef WIDE
-# define SIMPLE_MEMCMP simple_wmemcmp
int
-simple_wmemcmp (const wchar_t *s1, const wchar_t *s2, size_t n)
+SIMPLE_MEMCMP (const wchar_t *s1, const wchar_t *s2, size_t n)
{
int ret = 0;
/* Warning!
@@ -40,10 +44,8 @@ simple_wmemcmp (const wchar_t *s1, const wchar_t *s2, size_t n)
#else
# include <limits.h>
-# define SIMPLE_MEMCMP simple_memcmp
-
int
-simple_memcmp (const char *s1, const char *s2, size_t n)
+SIMPLE_MEMCMP (const char *s1, const char *s2, size_t n)
{
int ret = 0;