diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2004-08-02 05:21:47 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2004-08-02 05:21:47 +0000 |
commit | 5682fe455f57678dbc678fc45188d7435383db73 (patch) | |
tree | d108624df1c92b3f4f6946f498d77963e34a1826 /lib | |
parent | b6f35b5d52577b78dd3cb7d60916f1ac2a71575d (diff) | |
download | coreutils-5682fe455f57678dbc678fc45188d7435383db73.tar.xz |
Don't include inttypes.h or stdint.h.
(UNALIGNED_P): Remove.
(__memrchr): Use size_t, not uintptr_t, to test alignment.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/memrchr.c | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/lib/memrchr.c b/lib/memrchr.c index 5832ef82a..e34d65ed0 100644 --- a/lib/memrchr.c +++ b/lib/memrchr.c @@ -39,22 +39,6 @@ #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 - #undef __memrchr #undef memrchr @@ -77,7 +61,7 @@ __memrchr (void const *s, int c_in, size_t n) /* Handle the last 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; - n > 0 && UNALIGNED_P (char_ptr); + n > 0 && (size_t) char_ptr % sizeof longword != 0; --n) if (*--char_ptr == c) return (void *) char_ptr; |