Mail Archives: cygwin/2002/05/02/12:48:22
On Tue, Apr 30, 2002 at 04:54:18PM -0600, Eric Blake wrote:
> Eric Blake wrote:
> > [...]
> 2002-04-30 Eric Blake <ebb9 AT email DOT byu DOT edu>
>
> * path.cc (hash_path_name): Improve hash function strength.
>
> $ diff -u path.cc.bak path.cc
> --- path.cc.bak Tue Apr 30 16:32:52 2002
> +++ path.cc Tue Apr 30 16:40:14 2002
> @@ -3136,7 +3136,7 @@
> hash = cygheap->cwd.get_hash ();
> if (name[0] == '.' && name[1] == '\0')
> return hash;
> - hash += hash_path_name (hash, "\\");
> + hash = (hash << 5) - hash + '\\';
> }
> }
>
> @@ -3146,8 +3146,7 @@
> do
> {
> int ch = cyg_tolower(*name);
> - hash += ch + (ch << 17);
> - hash ^= hash >> 2;
> + hash = (hash << 5) - hash + ch;
> }
> while (*++name != '\0' &&
> !(*name == '\\' && (!name[1] || (name[1] == '.' && !name[2]))));
>
Thanks for that patch. I've applied it. Check out the next
developers snapshot.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Developer mailto:cygwin AT cygwin DOT com
Red Hat, Inc.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -