projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
.
[gnulib.git]
/
lib
/
memchr.c
diff --git
a/lib/memchr.c
b/lib/memchr.c
index
bb8b813
..
44a9dc5
100644
(file)
--- a/
lib/memchr.c
+++ b/
lib/memchr.c
@@
-21,14
+21,13
@@
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
#ifdef HAVE_CONFIG_H
Cambridge, MA 02139, USA. */
#ifdef HAVE_CONFIG_H
-#if defined (CONFIG_BROKETS)
-/* We use <config.h> instead of "config.h" so that a compilation
- using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
- (which it would do because it found this file in $srcdir). */
#include <config.h>
#include <config.h>
-#else
-#include "config.h"
#endif
#endif
+
+#if (SIZEOF_LONG != 4 && SIZEOF_LONG != 8)
+ error This function works only on systems for which sizeof(long) is 4 or 8.
+/* The previous line would begin with `#error,' but some compilers can't
+ handle that even when the condition is false. */
#endif
/* Search no more than N bytes of S for C. */
#endif
/* Search no more than N bytes of S for C. */
@@
-67,19
+66,18
@@
memchr (s, c, n)
The 1-bits make sure that carries propagate to the next 0-bit.
The 0-bits provide holes for carries to fall into. */
The 1-bits make sure that carries propagate to the next 0-bit.
The 0-bits provide holes for carries to fall into. */
-#ifdef LONG_64_BITS
- /* 64-bit version of the magic. */
+#if (SIZEOF_LONG == 8)
magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
#else
magic_bits = 0x7efefeff;
magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
#else
magic_bits = 0x7efefeff;
-#endif /*
LONG_64_BITS
*/
+#endif /*
SIZEOF_LONG == 8
*/
/* Set up a longword, each of whose bytes is C. */
charmask = c | (c << 8);
charmask |= charmask << 16;
/* Set up a longword, each of whose bytes is C. */
charmask = c | (c << 8);
charmask |= charmask << 16;
-#if
def LONG_64_BITS
+#if
(SIZEOF_LONG == 8)
charmask |= charmask << 32;
charmask |= charmask << 32;
-#endif /*
LONG_64_BITS
*/
+#endif /*
SIZEOF_LONG == 8
*/
if (sizeof (longword) > 8)
abort ();
if (sizeof (longword) > 8)
abort ();
@@
-149,7
+147,7
@@
memchr (s, c, n)
return (char *) &cp[2];
if (cp[3] == c)
return (char *) &cp[3];
return (char *) &cp[2];
if (cp[3] == c)
return (char *) &cp[3];
-#if
def LONG_64_BITS
+#if
(SIZEOF_LONG == 8)
if (cp[4] == c)
return (char *) &cp[4];
if (cp[5] == c)
if (cp[4] == c)
return (char *) &cp[4];
if (cp[5] == c)
@@
-158,7
+156,7
@@
memchr (s, c, n)
return (char *) &cp[6];
if (cp[7] == c)
return (char *) &cp[7];
return (char *) &cp[6];
if (cp[7] == c)
return (char *) &cp[7];
-#endif /*
LONG_64_BITS
*/
+#endif /*
SIZEOF_LONG == 8
*/
}
n -= sizeof (longword);
}
n -= sizeof (longword);