Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use PTR_ALIGN_DOWN on strcspn and strspn
Tested on aarch64.

	* string/strcspn.c (strcspn): Use PTR_ALIGN_DOWN.
	* string/strspn.c (strspn): Likewise.
  • Loading branch information
Adhemerval Zanella committed Apr 1, 2016
1 parent 344303f commit 2e51bc3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -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>

* benchtests/bench-memset.c (do_test): Support 64-byte
Expand Down
3 changes: 2 additions & 1 deletion string/strcspn.c
Expand Up @@ -17,6 +17,7 @@

#include <string.h>
#include <stdint.h>
#include <libc-internal.h>

#undef strcspn

Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion string/strspn.c
Expand Up @@ -17,6 +17,7 @@

#include <string.h>
#include <stdint.h>
#include <libc-internal.h>

#undef strspn
#ifndef STRSPN
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 2e51bc3

Please sign in to comment.