summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2009-06-26 20:35:39 -0600
committerEric Blake <ebb9@byu.net>2009-06-26 20:35:39 -0600
commit724c9cba4f9e8f7925d93f5aaa9899de8fa37f30 (patch)
tree51f1bef052eb5526cad08c472a073d866aea6c00
parent14b8a31efabcfcd3add902710063d1381576fda2 (diff)
downloadm4-724c9cba4f9e8f7925d93f5aaa9899de8fa37f30.tar.gz
Use bitrotate for hashing.
* gnulib: Update to latest. * ltdl/m4/gnulib-cache.m4: Import bitrotate module. * m4/hash.c (m4_hash_string_hash): Use it. Signed-off-by: Eric Blake <ebb9@byu.net> (cherry picked from commit 891a0fd44d0666fc0576071ec9866cb2b87490eb)
-rw-r--r--ChangeLog5
m---------gnulib0
-rw-r--r--ltdl/m4/gnulib-cache.m43
-rw-r--r--m4/hash.c6
4 files changed, 11 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 49b20f21..70f7bccb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2009-06-26 Eric Blake <ebb9@byu.net>
+ Use bitrotate for hashing.
+ * gnulib: Update to latest.
+ * ltdl/m4/gnulib-cache.m4: Import bitrotate module.
+ * m4/hash.c (m4_hash_string_hash): Use it.
+
Fix description of limits on diversions.
* doc/m4.texinfo (Diversions): Fix grammar. Be less pessimistic
about limitations.
diff --git a/gnulib b/gnulib
-Subproject dcc2f67b6ffab6e9def088ccbf7627edcda4bba
+Subproject 836f3974faad2f3de7bafd46719b77d6632a4c9
diff --git a/ltdl/m4/gnulib-cache.m4 b/ltdl/m4/gnulib-cache.m4
index d72313b0..ec907ec4 100644
--- a/ltdl/m4/gnulib-cache.m4
+++ b/ltdl/m4/gnulib-cache.m4
@@ -15,7 +15,7 @@
# Specification in the form of a command-line invocation:
-# gnulib-tool --import --dir=. --local-dir=local --lib=libgnu --source-base=gnu --m4-base=ltdl/m4 --doc-base=doc --tests-base=tests/gnu --aux-dir=build-aux --with-tests --libtool --macro-prefix=M4 assert autobuild avltree-oset binary-io clean-temp cloexec close-stream closein config-h configmake dirname error execute exit fdl-1.3 fflush filenamecat flexmember fopen fopen-safer freadptr freadseek fseeko gendocs gettext git-version-gen gnumakefile gnupload gpl-3.0 intprops memchr2 memcmp2 memmem mkstemp obstack obstack-printf-posix pipe progname propername quote regex regexprops-generic rename snprintf-posix sprintf-posix stdbool stdlib-safer strnlen strtod strtol tempname unlocked-io vasnprintf-posix verify verror wait-process xalloc xalloc-die xmemdup0 xprintf-posix xstrndup xvasprintf-posix
+# gnulib-tool --import --dir=. --local-dir=local --lib=libgnu --source-base=gnu --m4-base=ltdl/m4 --doc-base=doc --tests-base=tests/gnu --aux-dir=build-aux --with-tests --libtool --macro-prefix=M4 assert autobuild avltree-oset binary-io bitrotate clean-temp cloexec close-stream closein config-h configmake dirname error execute exit fdl-1.3 fflush filenamecat flexmember fopen fopen-safer freadptr freadseek fseeko gendocs gettext git-version-gen gnumakefile gnupload gpl-3.0 intprops memchr2 memcmp2 memmem mkstemp obstack obstack-printf-posix pipe progname propername quote regex regexprops-generic rename snprintf-posix sprintf-posix stdbool stdlib-safer strnlen strtod strtol tempname unlocked-io vasnprintf-posix verify verror wait-process xalloc xalloc-die xmemdup0 xprintf-posix xstrndup xvasprintf-posix
# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([local])
@@ -24,6 +24,7 @@ gl_MODULES([
autobuild
avltree-oset
binary-io
+ bitrotate
clean-temp
cloexec
close-stream
diff --git a/m4/hash.c b/m4/hash.c
index c07b62d4..a016fbf3 100644
--- a/m4/hash.c
+++ b/m4/hash.c
@@ -1,5 +1,6 @@
/* GNU m4 -- A simple macro processor
- Copyright (C) 2001, 2006, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2006, 2007, 2008, 2009 Free Software
+ Foundation, Inc.
Written by Gary V. Vaughan <gary@gnu.org>
This file is part of GNU M4.
@@ -28,6 +29,7 @@
#include "hash.h"
#include "m4private.h"
+#include "bitrotate.h"
#include <limits.h>
typedef struct hash_node hash_node;
@@ -650,7 +652,7 @@ m4_hash_string_hash (const void *ptr)
size_t val = len;
while (len--)
- val = (val << 7) + (val >> (sizeof val * CHAR_BIT - 7)) + to_uchar (*s++);
+ val = rotl_sz (val, 7) + to_uchar (*s++);
return val;
}