diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2004-07-29 17:34:20 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2004-07-29 17:34:20 +0000 |
commit | f03b0c306018102ebc9a0e9f0dad012b7416bd92 (patch) | |
tree | 5b6e6d179ebecfd4461c77c7183167b4697935e1 /lib/memrchr.c | |
parent | 3a7060d519a3c7600f81cd5b874a2a7486e30caf (diff) | |
download | coreutils-f03b0c306018102ebc9a0e9f0dad012b7416bd92.tar.xz |
(UNALIGNED_P): Use sizeof, not alignof.
Diffstat (limited to 'lib/memrchr.c')
-rw-r--r-- | lib/memrchr.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/memrchr.c b/lib/memrchr.c index d3618cb29..5832ef82a 100644 --- a/lib/memrchr.c +++ b/lib/memrchr.c @@ -1,6 +1,6 @@ /* memrchr -- find the last occurrence of a byte in a memory block - Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003 Free + Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003, 2004 Free Software Foundation, Inc. Based on strlen implementation by Torbjorn Granlund (tege@sics.se), @@ -46,9 +46,11 @@ # 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 |