diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2004-08-02 05:21:12 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2004-08-02 05:21:12 +0000 |
commit | b6f35b5d52577b78dd3cb7d60916f1ac2a71575d (patch) | |
tree | 3e5751c41c649b9da8306200b06f36f98d69236f /lib | |
parent | 90cfcabe9570779a66bd5c3d954eea6081f7e2b1 (diff) | |
download | coreutils-b6f35b5d52577b78dd3cb7d60916f1ac2a71575d.tar.xz |
Don't include inttypes.h or stdint.h.
(UNALIGNED_P): Remove.
(__memchr): Use size_t, not uintptr_t, to test alignment.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/memchr.c | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/lib/memchr.c b/lib/memchr.c index c80be4625..eacb5c935 100644 --- a/lib/memchr.c +++ b/lib/memchr.c @@ -41,22 +41,6 @@ USA. */ #include <limits.h> -#if HAVE_INTTYPES_H -# include <inttypes.h> -#endif -#if defined _LIBC || HAVE_STDINT_H -# include <stdint.h> -#endif - -/* Use sizeof, not alignof, for better performance on some hosts. For - example, on m68k-linux alignof (type) will always be at most 2, but - you get better performance with a 4-byte aligned pointer. */ -#ifdef UINTPTR_MAX -# define UNALIGNED_P(p) (((uintptr_t) p) % sizeof (unsigned long int) != 0) -#else -# define UNALIGNED_P(p) 1 -#endif - #if HAVE_BP_SYM_H || defined _LIBC # include <bp-sym.h> #else @@ -81,7 +65,7 @@ __memchr (void const *s, int c_in, size_t n) /* Handle the first few characters by reading one character at a time. Do this until CHAR_PTR is aligned on a longword boundary. */ for (char_ptr = (const unsigned char *) s; - n > 0 && UNALIGNED_P (char_ptr); + n > 0 && (size_t) char_ptr % sizeof longword != 0; --n, ++char_ptr) if (*char_ptr == c) return (void *) char_ptr; |