summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1993-10-21 17:08:57 +0000
committerJim Meyering <jim@meyering.net>1993-10-21 17:08:57 +0000
commite93ac7a384ea8c1e2e4cf4993653450b53b9c2f7 (patch)
treed2900e8b914886e6a428cf654203839fc96a1d32
parent58514a265eac0bffd00bf387d47d449fcc09c3f4 (diff)
downloadgnulib-TEXTUTILS-1_8c.tar.gz
GNU text utilitiesTEXTUTILS-1_8c
-rw-r--r--lib/memchr.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/memchr.c b/lib/memchr.c
index f69c301c4e..7495106362 100644
--- a/lib/memchr.c
+++ b/lib/memchr.c
@@ -56,10 +56,11 @@ 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. */
- magic_bits = 0x7efefeff;
#ifdef LONG_64_BITS
/* 64-bit version of the magic. */
- magic_bits = (0x7efefefe << 32) | 0xfefefeff;
+ magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+#else
+ magic_bits = 0x7efefeff;
#endif /* LONG_64_BITS */
/* Set up a longword, each of whose bytes is C. */
@@ -68,6 +69,9 @@ memchr (s, c, n)
#ifdef LONG_64_BITS
charmask |= charmask << 32;
#endif /* LONG_64_BITS */
+ if (sizeof (longword) > 8)
+ abort ();
+
/* Instead of the traditional loop which tests each character,
we will test a longword at a time. The tricky part is testing