about summary refs log tree commit diff
path: root/benchtests/bench-string.h
diff options
context:
space:
mode:
authorWilco Dijkstra <wdijkstr@arm.com>2018-12-21 18:52:40 +0000
committerWilco Dijkstra <wdijkstr@arm.com>2018-12-21 18:52:40 +0000
commit90d3320d7f57fae3d2f89d907e8307b6a76d133d (patch)
treef9089d25d13b05f53aa2e579c34be4e13f44e857 /benchtests/bench-string.h
parent5d025ea61762c5995abb2273780f4cf28f17cedf (diff)
downloadglibc-90d3320d7f57fae3d2f89d907e8307b6a76d133d.tar.gz
glibc-90d3320d7f57fae3d2f89d907e8307b6a76d133d.tar.xz
glibc-90d3320d7f57fae3d2f89d907e8307b6a76d133d.zip
Refactor string benchtests
Refactor string benchtests by moving duplicated defines into
bench-string.h.

	* benchtests/bench-memchr.c: Cleanup defines.
	* benchtests/bench-memcmp.c: Likewise.
	* benchtests/bench-memset.c: Likewise.
	* benchtests/bench-memset-large.c: Likewise.
	* benchtests/bench-memset-walk.c: Likewise.
	* benchtests/bench-stpcpy.c: Likewise.
	* benchtests/bench-stpncpy.c: Likewise.
	* benchtests/bench-strcat.c: Likewise.
	* benchtests/bench-strchr.c: Likewise.
	* benchtests/bench-strcmp.c: Likewise.
	* benchtests/bench-strcpy.c: Likewise.
	* benchtests/bench-strcspn.c: Likewise.
	* benchtests/bench-string.h: Likewise.
	* benchtests/bench-strlen.c: Likewise.
	* benchtests/bench-strncat.c: Likewise.
	* benchtests/bench-strncmp.c: Likewise.
	* benchtests/bench-strncpy.c: Likewise.
	* benchtests/bench-strnlen.c: Likewise.
	* benchtests/bench-strpbrk.c: Likewise.
	* benchtests/bench-strrchr.c: Likewise.
	* benchtests/bench-strspn.c: Likewise.
Diffstat (limited to 'benchtests/bench-string.h')
-rw-r--r--benchtests/bench-string.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/benchtests/bench-string.h b/benchtests/bench-string.h
index f8389982e9..f173a57efa 100644
--- a/benchtests/bench-string.h
+++ b/benchtests/bench-string.h
@@ -65,6 +65,56 @@ extern impl_t __start_impls[], __stop_impls[];
 # define GLRO(x) _##x
 # include "bench-timing.h"
 
+# ifndef WIDE
+#  define CHAR char
+#  define UCHAR unsigned char
+#  define CHARBYTES 1
+#  define MAX_CHAR CHAR_MAX
+#  define MEMCHR memchr
+#  define MEMCMP memcmp
+#  define MEMCPY memcpy
+#  define MEMSET memset
+#  define STRCAT strcat
+#  define STRLEN strlen
+#  define STRCMP strcmp
+#  define STRCHR strchr
+#  define STRCPY strcpy
+#  define STRNLEN strnlen
+#  define STRCSPN strcspn
+#  define STRNCAT strncat
+#  define STRNCMP strncmp
+#  define STRNCPY strncpy
+#  define STRPBRK strpbrk
+#  define STRRCHR strrchr
+#  define STRSPN strspn
+#  define STPCPY stpcpy
+#  define STPNCPY stpncpy
+# else
+#  include <wchar.h>
+#  define CHAR wchar_t
+#  define UCHAR wchar_t
+#  define CHARBYTES 4
+#  define MAX_CHAR WCHAR_MAX
+#  define MEMCHR wmemchr
+#  define MEMCMP wmemcmp
+#  define MEMCPY wmemcpy
+#  define MEMSET wmemset
+#  define STRCAT wcscat
+#  define STRLEN wcslen
+#  define STRCMP wcscmp
+#  define STRCHR wcschr
+#  define STRCPY wcscpy
+#  define STRNLEN wcsnlen
+#  define STRCSPN wcscspn
+#  define STRNCAT wcsncat
+#  define STRNCMP wcsncmp
+#  define STRNCPY wcsncpy
+#  define STRPBRK wcspbrk
+#  define STRRCHR wcsrchr
+#  define STRSPN wcsspn
+#  define STPCPY wcpcpy
+#  define STPNCPY wcpncpy
+# endif /* WIDE */
 
 # define TEST_FUNCTION test_main
 # ifndef TIMEOUT