From: Adhemerval Zanella Date: Fri, 1 Apr 2016 21:33:03 +0000 (-0300) Subject: Use PTR_ALIGN_DOWN on strcspn and strspn X-Git-Tag: glibc-2.24~429 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e51bc3813ca3fe72fd197d08d79496e46669f43;p=thirdparty%2Fglibc.git Use PTR_ALIGN_DOWN on strcspn and strspn Tested on aarch64. * string/strcspn.c (strcspn): Use PTR_ALIGN_DOWN. * string/strspn.c (strspn): Likewise. --- diff --git a/ChangeLog b/ChangeLog index fc861169124..c181042349e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-04-01 Adhemerval Zanella + + * string/strcspn.c (strcspn): Use PTR_ALIGN_DOWN. + * string/strspn.c (strspn): Likewise. + 2016-04-01 H.J. Lu * benchtests/bench-memset.c (do_test): Support 64-byte diff --git a/string/strcspn.c b/string/strcspn.c index c535dd1c3dd..0e01193bc52 100644 --- a/string/strcspn.c +++ b/string/strcspn.c @@ -17,6 +17,7 @@ #include #include +#include #undef strcspn @@ -52,7 +53,7 @@ STRCSPN (const char *str, const char *reject) if (p[s[2]]) return 2; 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; do diff --git a/string/strspn.c b/string/strspn.c index f98340b1b29..86f76ea9881 100644 --- a/string/strspn.c +++ b/string/strspn.c @@ -17,6 +17,7 @@ #include #include +#include #undef strspn #ifndef STRSPN @@ -58,7 +59,8 @@ STRSPN (const char *str, const char *accept) if (!p[s[2]]) return 2; 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; do { s += 4;