From b6f35b5d52577b78dd3cb7d60916f1ac2a71575d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 2 Aug 2004 05:21:12 +0000 Subject: [PATCH] Don't include inttypes.h or stdint.h. (UNALIGNED_P): Remove. (__memchr): Use size_t, not uintptr_t, to test alignment. --- lib/memchr.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/lib/memchr.c b/lib/memchr.c index c80be46251..eacb5c935f 100644 --- a/lib/memchr.c +++ b/lib/memchr.c @@ -41,22 +41,6 @@ USA. */ #include -#if HAVE_INTTYPES_H -# include -#endif -#if defined _LIBC || HAVE_STDINT_H -# include -#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 #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; -- 2.47.2