On Mon, Feb 28, 2005 at 10:49:58AM -0500, Hui Zhou wrote:
On Mon, Feb 28, 2005 at 09:40:20AM +0000, Johan V. wrote:
return ( a+b+c == 180 ) * (a>0) * (b>0) * (c>0) *
      ( 1 + (a==b) + (a==c) + (b==c) );

Frankly I am not sure whether gcc will optimize away those multiplications and summations. I will appreciate it if you will find out and let me know.

I tried with gcc -O3. It seems gcc does the optimization I described above, but it still end up with more conditional jumps and an extra imul and a few incl than an straight forward if version.


It does a pretty good job, but we are asking too much :)

Cheers,
--
Hui Zhou
--
http://linuxfromscratch.org/mailman/listinfo/lfs-chat
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to