1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

Use PTR_ALIGN_DOWN on strcspn and strspn

Tested on aarch64.

	* string/strcspn.c (strcspn): Use PTR_ALIGN_DOWN.
	* string/strspn.c (strspn): Likewise.
This commit is contained in:
Adhemerval Zanella
2016-04-01 18:33:03 -03:00
parent 344303f3cf
commit 2e51bc3813
3 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2016-04-01 Adhemerval Zanella <adhemerval.zanella@linaro.org>
* string/strcspn.c (strcspn): Use PTR_ALIGN_DOWN.
* string/strspn.c (strspn): Likewise.
2016-04-01 H.J. Lu <hongjiu.lu@intel.com> 2016-04-01 H.J. Lu <hongjiu.lu@intel.com>
* benchtests/bench-memset.c (do_test): Support 64-byte * benchtests/bench-memset.c (do_test): Support 64-byte

View File

@ -17,6 +17,7 @@
#include <string.h> #include <string.h>
#include <stdint.h> #include <stdint.h>
#include <libc-internal.h>
#undef strcspn #undef strcspn
@ -52,7 +53,7 @@ STRCSPN (const char *str, const char *reject)
if (p[s[2]]) return 2; if (p[s[2]]) return 2;
if (p[s[3]]) return 3; if (p[s[3]]) return 3;
s = (unsigned char *) ((uintptr_t)(s) & ~3); s = (unsigned char *) PTR_ALIGN_DOWN (s, 4);
unsigned int c0, c1, c2, c3; unsigned int c0, c1, c2, c3;
do do

View File

@ -17,6 +17,7 @@
#include <string.h> #include <string.h>
#include <stdint.h> #include <stdint.h>
#include <libc-internal.h>
#undef strspn #undef strspn
#ifndef STRSPN #ifndef STRSPN
@ -58,7 +59,8 @@ STRSPN (const char *str, const char *accept)
if (!p[s[2]]) return 2; if (!p[s[2]]) return 2;
if (!p[s[3]]) return 3; if (!p[s[3]]) return 3;
s = (unsigned char *) ((uintptr_t)(s) & ~3); s = (unsigned char *) PTR_ALIGN_DOWN (s, 4);
unsigned int c0, c1, c2, c3; unsigned int c0, c1, c2, c3;
do { do {
s += 4; s += 4;