diff options
author | Noah Goldstein <goldstein.w.n@gmail.com> | 2022-10-18 17:44:09 -0700 |
---|---|---|
committer | Noah Goldstein <goldstein.w.n@gmail.com> | 2022-10-19 17:31:03 -0700 |
commit | 643a2d01399188192e0da234581034f77c892054 (patch) | |
tree | 64d0e00ac4f7a9865a19c416eccdc6639bd371c1 /benchtests/bench-strnlen.c | |
parent | b412213eee0afa3b51dfe92b736dfc7c981309f5 (diff) | |
download | glibc-643a2d01399188192e0da234581034f77c892054.tar glibc-643a2d01399188192e0da234581034f77c892054.tar.gz glibc-643a2d01399188192e0da234581034f77c892054.tar.bz2 glibc-643a2d01399188192e0da234581034f77c892054.zip |
Bench: Improve benchtests for memchr, strchr, strnlen, strrchr
1. Add more complete coverage in the medium size range.
2. In strnlen remove the `1 << i` which was UB (`i` could go beyond
32/64)
Diffstat (limited to 'benchtests/bench-strnlen.c')
-rw-r--r-- | benchtests/bench-strnlen.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/benchtests/bench-strnlen.c b/benchtests/bench-strnlen.c index 13b46b3f57..82c02eb6ed 100644 --- a/benchtests/bench-strnlen.c +++ b/benchtests/bench-strnlen.c @@ -195,19 +195,19 @@ test_main (void) { for (j = 0; j <= (704 / sizeof (CHAR)); j += (32 / sizeof (CHAR))) { - do_test (&json_ctx, 0, 1 << i, (i + j), BIG_CHAR); do_test (&json_ctx, 0, i + j, i, BIG_CHAR); - - do_test (&json_ctx, 64, 1 << i, (i + j), BIG_CHAR); do_test (&json_ctx, 64, i + j, i, BIG_CHAR); + do_test (&json_ctx, 0, i, i + j, BIG_CHAR); + do_test (&json_ctx, 64, i, i + j, BIG_CHAR); + if (j < i) { - do_test (&json_ctx, 0, 1 << i, i - j, BIG_CHAR); do_test (&json_ctx, 0, i - j, i, BIG_CHAR); - - do_test (&json_ctx, 64, 1 << i, i - j, BIG_CHAR); do_test (&json_ctx, 64, i - j, i, BIG_CHAR); + + do_test (&json_ctx, 0, i, i - j, BIG_CHAR); + do_test (&json_ctx, 64, i, i - j, BIG_CHAR); } } } |