Re: g_str_hash
- From: Tim Janik <timj gtk org>
- To: gtk-devel-list redhat com
- cc: kenelson sequoia ece ucdavis edu
- Subject: Re: g_str_hash
- Date: Sat, 12 Feb 2000 02:01:41 +0100 (CET)
On Fri, 11 Feb 2000, Karl Nelson wrote:
> >the only think left to note is that you can spare the first
> >hash step, since 0 needs no propagation. so we get:
> >
> >guint
> >g_str_hash (gconstpointer key)
> >{
> > const gchar *p = key;
> > guint h = *p;
> >
> > for (p = key + 1; *p != '\0'; p += 1)
> > h = (h << 5) - h + *p;
> >
> > return h;
> >}
>
> One objection, it segfaults on 0 :-)
that's a feature, not a bug.
we'll simply document that case!
ok i'm dump, from hereon i rpomise to continue posting untested
code in the future ;)
>
> --Karl
>
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]