Re: [freenet-dev] [freenet-cvs] r19759 - trunk/freenet/src/f…

Top Page
Author: Matthew Toseland
Date:  
To: devl
Subject: Re: [freenet-dev] [freenet-cvs] r19759 - trunk/freenet/src/freenet/support
Delete this message
Reply to this message
gpg: Signature made Tue May 6 00:47:03 2008 UTC using DSA key ID E43DA450
gpg: Good signature from "Matthew John Toseland <toad@amphibian.dyndns.org>"
On Monday 05 May 2008 14:01, j16sdiz@??? wrote:
> Author: j16sdiz
> Date: 2008-05-05 13:01:55 +0000 (Mon, 05 May 2008)
> New Revision: 19759
>
> Modified:
> trunk/freenet/src/freenet/support/NumberedItemComparator.java
> Log:
> use assert


Base must be odd?? Explain?

Also the class should be package private if you're going to make this sort of
assumptions...
>
>
> Modified: trunk/freenet/src/freenet/support/NumberedItemComparator.java
> ===================================================================
> --- trunk/freenet/src/freenet/support/NumberedItemComparator.java    2008-05-05

13:01:35 UTC (rev 19758)
> +++ trunk/freenet/src/freenet/support/NumberedItemComparator.java    2008-05-05

13:01:55 UTC (rev 19759)
> @@ -42,11 +42,13 @@
> secondDistance = i2 - i1; // smaller => i2 > i1
> firstDistance = i1 + Long.MAX_VALUE - i2; // smaller => i1
> i2
> }
> + // REDFLAG: base must be odd, so we never get ==
> +            assert firstDistance != secondDistance &&

firstDistance != -secondDistance;
> +
> if(Math.abs(firstDistance) < Math.abs(secondDistance)) {
> return 1; // i1>i2
> } else //if(Math.abs(secondDistance) < Math.abs(firstDistance))

{
> return -1; // i2>i1
> - // REDFLAG: base must be odd, so we never get ==
> }
> }
>
>
> _______________________________________________
> cvs mailing list
> cvs@???
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
>
>