summaryrefslogtreecommitdiff
path: root/lib/memchr.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2004-07-29 17:33:38 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2004-07-29 17:33:38 +0000
commit3a7060d519a3c7600f81cd5b874a2a7486e30caf (patch)
tree98fb09d41204f05f64ecc2c1a9e32452bcdaa386 /lib/memchr.c
parent0bdefc2dcac212da26e27a06eb45e73f005fa82a (diff)
downloadcoreutils-3a7060d519a3c7600f81cd5b874a2a7486e30caf.tar.xz
(UNALIGNED_P): Use sizeof, not alignof.
Diffstat (limited to 'lib/memchr.c')
-rw-r--r--lib/memchr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/memchr.c b/lib/memchr.c
index 4cb1a8b51..2b2932fb1 100644
--- a/lib/memchr.c
+++ b/lib/memchr.c
@@ -48,9 +48,11 @@ USA. */
# include <stdint.h>
#endif
-#define alignof(type) offsetof (struct { char c; type x; }, x)
+/* 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) % alignof (unsigned long int) != 0)
+# define UNALIGNED_P(p) (((uintptr_t) p) % sizeof (unsigned long int) != 0)
#else
# define UNALIGNED_P(p) 1
#endif