diff options
author | Eric Blake <ebb9@byu.net> | 2009-06-25 12:08:25 -0600 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2009-06-25 21:17:47 -0600 |
commit | 891a0fd44d0666fc0576071ec9866cb2b87490eb (patch) | |
tree | 26976ceb55aa5580978c840740b415f9e3ae82e9 | |
parent | dae39a14fd724380af8d19a63703ab51db4d96d4 (diff) | |
download | m4-891a0fd44d0666fc0576071ec9866cb2b87490eb.tar.gz |
Use bitrotate for hashing.
* gnulib: Update to latest.
* m4/gnulib-cache.m4: Import bitrotate module.
* src/symtab.c (hash): Use it.
Signed-off-by: Eric Blake <ebb9@byu.net>
-rw-r--r-- | ChangeLog | 5 | ||||
m--------- | gnulib | 0 | ||||
-rw-r--r-- | m4/gnulib-cache.m4 | 3 | ||||
-rw-r--r-- | src/symtab.c | 3 |
4 files changed, 9 insertions, 2 deletions
@@ -1,5 +1,10 @@ 2009-06-25 Eric Blake <ebb9@byu.net> + Use bitrotate for hashing. + * gnulib: Update to latest. + * m4/gnulib-cache.m4: Import bitrotate module. + * src/symtab.c (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 12f78b4faa14cd2da952f865979843dee79fcf9 +Subproject 836f3974faad2f3de7bafd46719b77d6632a4c9 diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4 index d3e4d734..3db1a442 100644 --- a/m4/gnulib-cache.m4 +++ b/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=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --with-tests --no-libtool --macro-prefix=M4 announce-gen assert autobuild avltree-oset binary-io clean-temp cloexec close-stream closein config-h dirname error execute fdl-1.3 fflush filenamecat flexmember fopen fopen-safer freadptr freadseek fseeko gendocs getopt git-version-gen gnumakefile gnupload gpl-3.0 hash intprops maintainer-makefile memchr2 memcmp2 memmem mkstemp obstack obstack-printf-posix pipe progname quote regex rename snprintf-posix stdbool stdint stdlib-safer strtod strtol unlocked-io vasnprintf-posix verror version-etc version-etc-fsf wait-process xalloc xmemdup0 xprintf xvasprintf-posix +# gnulib-tool --import --dir=. --local-dir=local --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --with-tests --no-libtool --macro-prefix=M4 announce-gen assert autobuild avltree-oset binary-io bitrotate clean-temp cloexec close-stream closein config-h dirname error execute fdl-1.3 fflush filenamecat flexmember fopen fopen-safer freadptr freadseek fseeko gendocs getopt git-version-gen gnumakefile gnupload gpl-3.0 hash intprops maintainer-makefile memchr2 memcmp2 memmem mkstemp obstack obstack-printf-posix pipe progname quote regex rename snprintf-posix stdbool stdint stdlib-safer strtod strtol unlocked-io vasnprintf-posix verror version-etc version-etc-fsf wait-process xalloc xmemdup0 xprintf xvasprintf-posix # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([local]) @@ -25,6 +25,7 @@ gl_MODULES([ autobuild avltree-oset binary-io + bitrotate clean-temp cloexec close-stream diff --git a/src/symtab.c b/src/symtab.c index 338bf17b..dd9eb67d 100644 --- a/src/symtab.c +++ b/src/symtab.c @@ -33,6 +33,7 @@ #include "m4.h" +#include "bitrotate.h" #include "hash.h" #ifdef DEBUG_SYM @@ -112,7 +113,7 @@ hash (const char *s, size_t len) /* This algorithm was originally borrowed from GNU Emacs, but has been modified to allow embedded NUL. */ while (len--) - val = (val << 7) + (val >> (sizeof val * CHAR_BIT - 7)) + to_uchar (*s++); + val = rotl_sz (val, 7) + to_uchar (*s++); return val; } |