[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] [merge-tracking] Code clarity fix

From: Daniel Berlin <dberlin_at_dberlin.org>
Date: 2006-09-07 02:11:37 CEST

> I haven't been following the merge tracking stuff, but detecting
> overlapping ranges is notorious for being both tricky and simple: it's
> tricky to get the algorithm right, but the right algorithm is simple.
>
> static svn_boolean_t
> combine_ranges(svn_merge_range_t **output,
> svn_merge_range_t *in1,
> svn_merge_range_t *in2)
> {
> if (in1->start <= in2->end + 1 && in2->start <= in1->end + 1)
> {
> (*output)->start = MIN(in1->start, in2->start);
> (*output)->end = MAX(in1->end, in2->end);
> return TRUE;
> }
> else
> return FALSE;
> }
>
Yeah, this would work.

But you do realize a good compiler will optimize the longhand version
into this, right?
:)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Sep 7 02:31:59 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.