Re: balsa-list digest, Vol 1 #451 - 13 msgs
- From: Emmanuel <e allaud wanadoo fr>
- To: balsa-list gnome org
- Subject: Re: balsa-list digest, Vol 1 #451 - 13 msgs
- Date: Tue, 19 Jun 2001 08:38:21 +0200
On Mon, 18 Jun 2001 17:51:03 you wrote:
> > --- hash.c Fri Jan 3 15:18:25 1997
> > +++ hash.c.corr Sun Jun 17 17:25:08 2001
> > @@ -38,7 +38,7 @@
> > h = (h >= 0) ? h : h + n;
> > #endif
> >
> > - return (h % n);
> > + return h;
> > }
> >
>
> This breaks the hash function. It lets you return hash keys larger than your
> hash size.
I think it doesn't because you always have 0<= h < n when you quit the
loop (because h is a modulo n so you have -n < h < n and after when you
make h=(h>=0) ? h:h+n you allways get 0<=h<n) so the return h%n is
useless because you allways have h%n==h.
Or I'm too confused about something ?
Manu
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]