----- Original Message -----
From: "Cedric Beust" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 12, 2000 18:46
Subject: Re: Writing a uniform hashCode method
> > From: A mailing list for Enterprise JavaBeans development
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Jonathan K. Weedon
>
> > So, in real life a and b will fall into some range. Let's
> > say that a falls into the range [0-A], and b falls into
> > the range [0-B]. Then our hashCode above will fall into
> > a range:
> >
> > [0-(A+B)]
>
> Shouldn't that be [0 - max(A,B)]? (or more precisely, [0 - 1 << (1 + max of
> their log2]))
I think the correct upper bound is actually
1<<floor(1+max(log2(A),log2(B))) - 1
though you were close :-)
Of course we have
1<<floor(1+max(log2(A),log2(B))) - 1 <= A+B for all A,B>=0
So the range is even less than Jonathan originally gave.
...David
>
> (that doesn't invalidate all your good points)
>
> --
> Cedric
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".