diff options
Diffstat (limited to 'string')
-rw-r--r-- | string/test-memcpy-support.h | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/string/test-memcpy-support.h b/string/test-memcpy-support.h index f1763da..699c00c 100644 --- a/string/test-memcpy-support.h +++ b/string/test-memcpy-support.h @@ -84,7 +84,7 @@ do_one_test (impl_t *impl, char *dst, const char *src, size_t len) static void do_test (size_t align1, size_t align2, size_t len) { - size_t i, j, repeats; + size_t i, j; char *s1, *s2; align1 &= 4095; @@ -97,13 +97,16 @@ do_test (size_t align1, size_t align2, size_t len) s1 = (char *)(buf1 + align1); s2 = (char *)(buf2 + align2); - for (repeats = 0; repeats < 2; ++repeats) + for (size_t repeats = 0; repeats < 2; ++repeats) { for (i = 0, j = 1; i < len; i++, j += 23) s1[i] = j; FOR_EACH_IMPL (impl, 0) do_one_test (impl, s2, s1, len); + + s1 = (char *) (buf2 + align1); + s2 = (char *) (buf1 + align2); } } @@ -138,30 +141,29 @@ do_test1 (size_t align1, size_t align2, size_t size) unaligned_uint32_t *dest = large_buf + align1; unaligned_uint32_t *src = large_buf + region_size + 2 * page_size + align2; size_t i; - size_t repeats; - for (repeats = 0; repeats < 2; repeats++) + for (size_t repeats = 0; repeats < 2; repeats++) { for (i = 0; i < array_size; i++) src[i] = (uint32_t)i; FOR_EACH_IMPL (impl, 0) - { - memset (dest, -1, size); - CALL (impl, (char *)dest, (char *)src, size); - if (memcmp (src, dest, size)) - { - for (i = 0; i < array_size; i++) - if (dest[i] != src[i]) - { - error (0, 0, - "Wrong result in function %s dst \"%p\" src \"%p\" " - "offset \"%zd\"", - impl->name, dest, src, i); - ret = 1; - munmap ((void *)large_buf, mmap_size); - return; - } - } - } + { + memset (dest, -1, size); + CALL (impl, (char *)dest, (char *)src, size); + if (memcmp (src, dest, size)) + { + for (i = 0; i < array_size; i++) + if (dest[i] != src[i]) + { + error (0, 0, + "Wrong result in function %s dst \"%p\" src \"%p\" " + "offset \"%zd\"", + impl->name, dest, src, i); + ret = 1; + munmap ((void *)large_buf, mmap_size); + return; + } + } + } dest = large_buf + region_size + 2 * page_size + align1; src = large_buf + align2; } |