[PATCH] Sort "loose" dives properly in-between trips

Miika Turkia miika.turkia at gmail.com
Mon Jan 7 09:56:41 PST 2013


On Mon, Jan 7, 2013 at 7:19 PM, Linus Torvalds
<torvalds at linux-foundation.org> wrote:
> On Mon, Jan 7, 2013 at 9:11 AM, Linus Torvalds
> <torvalds at linux-foundation.org> wrote:
>>
>> Don't you want to compare when_a/when_b when trips are NULL? Turning
>> that "return 0" into just "return when_a - when_b;" should do that..
>
> Side note: both your patch *and* that extension to it make be a bit
> worried. The problem is that the ordering needs to be properly
> anti-commutative and transitive, or the sort may get into endless
> loops. And I'm not 100% convinced your sort order is properly
> transitive (ie "a < b" and "b < c" has to imply "a < c", and I'm not
> conviced it does with your patch _or _ with the extension)

Your extension is clearly required. (I only had one dive not in trip,
thus didn't even consider this part of the sorting.)

When comparing the original sorting code and my code, a difference I
can see is that my code does not return 0 when the times are the same.
I believe the times should never be the same, but I am not sure about
it.  Otherwise the sorting uses the same logic as the trip sorting
part. Anyway, I'll craft a test set and play around with it to see if
anything odd pops up.

miika


More information about the subsurface mailing list