mirror of
git://sourceware.org/git/glibc.git
synced 2025-03-06 20:58:33 +01:00
Benchtests: Remove simple_memcmp
Remove the slow byte oriented simple_memcmp. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
parent
5de1508803
commit
183b425a05
1 changed files with 1 additions and 31 deletions
|
@ -19,46 +19,16 @@
|
||||||
#define TEST_MAIN
|
#define TEST_MAIN
|
||||||
#ifdef TEST_MEMCMPEQ
|
#ifdef TEST_MEMCMPEQ
|
||||||
# define TEST_NAME "__memcmpeq"
|
# define TEST_NAME "__memcmpeq"
|
||||||
# define SIMPLE_MEMCMP simple_memcmpeq
|
|
||||||
#elif defined WIDE
|
#elif defined WIDE
|
||||||
# define TEST_NAME "wmemcmp"
|
# define TEST_NAME "wmemcmp"
|
||||||
# define SIMPLE_MEMCMP simple_wmemcmp
|
|
||||||
#else
|
#else
|
||||||
# define TEST_NAME "memcmp"
|
# define TEST_NAME "memcmp"
|
||||||
# define SIMPLE_MEMCMP simple_memcmp
|
|
||||||
#endif
|
#endif
|
||||||
#include "bench-string.h"
|
#include "bench-string.h"
|
||||||
#ifdef WIDE
|
#include "json-lib.h"
|
||||||
|
|
||||||
int
|
|
||||||
SIMPLE_MEMCMP (const wchar_t *s1, const wchar_t *s2, size_t n)
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
/* Warning!
|
|
||||||
wmemcmp has to use SIGNED comparison for elements.
|
|
||||||
memcmp has to use UNSIGNED comparison for elemnts.
|
|
||||||
*/
|
|
||||||
while (n-- && (ret = *s1 < *s2 ? -1 : *s1 == *s2 ? 0 : 1) == 0) {s1++; s2++;}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
# include <limits.h>
|
|
||||||
|
|
||||||
int
|
|
||||||
SIMPLE_MEMCMP (const char *s1, const char *s2, size_t n)
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
while (n-- && (ret = *(unsigned char *) s1++ - *(unsigned char *) s2++) == 0);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# include "json-lib.h"
|
|
||||||
|
|
||||||
typedef int (*proto_t) (const CHAR *, const CHAR *, size_t);
|
typedef int (*proto_t) (const CHAR *, const CHAR *, size_t);
|
||||||
|
|
||||||
IMPL (SIMPLE_MEMCMP, 0)
|
|
||||||
IMPL (MEMCMP, 1)
|
IMPL (MEMCMP, 1)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Add table
Reference in a new issue