> > From: Holger Bettag <email@hidden>
> > Date: October 22, 2004 11:05:05 AM EDT
> > To: email@hidden
> > Subject: Re: float to int (kinda OT)
> > How about using the sign bits directly:
> >
> > if ((a | b | c) <0) return 1; else return 0;
> >
> > or totally without branch in this particular example:
> >
> > return ((unsigned)(a | b | c)) >> ((sizeof(int) << 3) - 1);
Nice...that's definitely faster! Note that both GCC 4 and XLC will produce
the same branch-less code for either case above:
or r4,r3,r4
or r4,r4,r5
srwi r3,r4,31
blr
--Sanjay
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail
_______________________________________________
Do not post admin requests to the list. They will be ignored.
PerfOptimization-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/perfoptimization-dev/email@hidden
This email sent to email@hidden