Re: balsa-list digest, Vol 1 #451 - 13 msgs



On 2001.06.19 07:38:21 +0100 Emmanuel wrote:
> 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
> 

Erm actually you are right. I was hasty and didn't pay enough atention 
when looking at the diff. return h%n is needed for the code path that's 
ifdefed out.

i must look into current mutt and investigate a code sync of libmutt

-- 
Carlos Morgado - chbm(at)chbm(dot)nu - http://chbm.nu/ -- gpgkey: 0x1FC57F0A
http://wwwkeys.pgp.net/ FP:0A27 35D3 C448 3641 0573 6876 2A37 4BB2 1FC5 7F0A
Software is like sex; it's better when it's free. - Linus Torvalds




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