Re: Proposed patch: Modify glib to permit embedded NULs in GString.



Derek Simkowiak <dereks@kd-dev.com> writes:

> -> guint
> -> g_string_hash (const GString *str)
> -> {
> ->   const gchar *p = str->str;
> ->   gint n = str->len;
> ->   guint h = 0;
> -> 
> ->   while (n--)
> ->     {
> ->       h = (h << 5) - h + *p;
> ->       p++;
> ->     }
> -> 
> ->   return h;
> -> }
> 
>      Owen,
> 	Where did you get this hashing algorithm?  (I noticed it's the
> same one as in g_str_hash() ).
> 
> 	I have a couple of books that cover hash algorithms and neither of
> them has this in it...

See the long thread titled g_str_hash().

http://mail.gnome.org/pipermail/gtk-devel-list/2000-February/thread.html

Regards,
                                        Owen




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]