about summary refs log tree commit diff
path: root/string/test-strcmp.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-12-17 14:39:23 -0500
committerUlrich Drepper <drepper@gmail.com>2011-12-17 14:39:23 -0500
commit1d3e4b618ae0217f1736753f3085f9c4fcc827bf (patch)
tree90a3f8d19f941a684e1482b8813c534d82cfb19e /string/test-strcmp.c
parenta2d18b64edb486825fb5946eefc2131426ccfec9 (diff)
downloadglibc-1d3e4b618ae0217f1736753f3085f9c4fcc827bf.tar.gz
glibc-1d3e4b618ae0217f1736753f3085f9c4fcc827bf.tar.xz
glibc-1d3e4b618ae0217f1736753f3085f9c4fcc827bf.zip
Optimized wcschr and wcscpy for x86-64 and x86-32
Diffstat (limited to 'string/test-strcmp.c')
-rw-r--r--string/test-strcmp.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/string/test-strcmp.c b/string/test-strcmp.c
index 9ea4df7597..5ed9626020 100644
--- a/string/test-strcmp.c
+++ b/string/test-strcmp.c
@@ -221,14 +221,14 @@ do_test (size_t align1, size_t align2, size_t len, int max_char,
 static void
 do_random_tests (void)
 {
-  for (size_t a = 0; a < CHARBYTES; a += CHARALIGN)
-    for (size_t b = 0; b < CHARBYTES; b += CHARALIGN)
-      {
-	UCHAR *p1 = (UCHAR *) (buf1 + page_size - 512 * CHARBYTES - a);
-	UCHAR *p2 = (UCHAR *) (buf2 + page_size - 512 * CHARBYTES - b);
+	UCHAR *p1 = (UCHAR *) (buf1 + page_size - 512 * CHARBYTES);
+	UCHAR *p2 = (UCHAR *) (buf2 + page_size - 512 * CHARBYTES);
 
 	for (size_t n = 0; n < ITERATIONS; n++)
 	  {
+      /* for wcscmp case align1 and align2 mean here alignment in wchar_t symbols, it 
+       equal 4*k alignment in bytes, we don't check other alignments like for example p1 = (wchar_t *)(buf1 + 1)
+       because it's wrong using of wchar_t type. */
 	    size_t align1 = random () & 31;
 	    size_t align2;
 	    if (random () & 1)
@@ -274,7 +274,7 @@ do_random_tests (void)
 	      }
 
 	    int result = 0;
-	    MEMCPY ((CHAR *) (p2 + align2), (CHAR *) (p1 + align1), pos);
+	    MEMCPY (p2 + align2, p1 + align1, pos);
 	    if (pos < len1)
 	      {
 		if (p2[align2 + pos] == p1[align1 + pos])
@@ -302,13 +302,12 @@ do_random_tests (void)
 		    || (r < 0 && result >= 0)
 		    || (r > 0 && result <= 0))
 		  {
-		    error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %zd, %zd, %zd, %zd) %d != %d, p1 %p p2 %p",
+		    error (0, 0, "Iteration %zd - wrong result in function %s (align in bytes: %zd, align in bytes: %zd, len1:  %zd, len2: %zd, pos: %zd) %d != %d, p1 %p p2 %p",
 			   n, impl->name, (size_t) (p1 + align1) & 63, (size_t) (p1 + align2) & 63, len1, len2, pos, r, result, p1, p2);
 		    ret = 1;
 		  }
 	      }
-	  }
-      }
+     }
 }
 
 static void