]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(UNALIGNED_P): Use sizeof, not alignof.
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 29 Jul 2004 17:33:38 +0000 (17:33 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 29 Jul 2004 17:33:38 +0000 (17:33 +0000)
lib/memchr.c

index 4cb1a8b510768f88c4e12b262172a4d2c9a95b61..2b2932fb18d55e91d6ca0e0d931a7a32700e5bae 100644 (file)
@@ -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