[PATCH 2/4] introduce region_overlap() function

Robert Jarzmik robert.jarzmik at free.fr
Sat Oct 6 15:44:54 EDT 2012


Sascha Hauer <s.hauer at pengutronix.de> writes:
> You made me curious. I tried to compile both and here is the result on
> ARM (I swapped the arguments left and right of the &&):
>
...zip...
>
> Maybe gcc isn't so clever on other architectures, I don't know ;)

You're right.
Same conclusion on x86 with gcc 4.7. I had tried that a long time ago (maybe 10
years or so) on x86, benchmarking both pure C and Java on this very function (it
was for aircrafts timeslots conflicts discovery).

At that time, the "startA <= endB && endA >= startB" was fastest. So compilation
technique have improved enough to write maintainable code after all :)

Cheers.

-- 
Robert



More information about the barebox mailing list