This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, spu] add libgcc functions __multi3, __udivmodti4, etc
I changed the function as following:
static
unsigned int count_leading_zeros(UDItype x)
{
int leading;
leading = W_TYPE_SIZE;
if (x > ((UDItype)1 << W_TYPE_SIZE))
>=, not >
{
x = (UDItype)x >> W_TYPE_SIZE;
x is already type UDItype, no need for the cast.
leading = 0;
}
return si_clz(x) + leading;
}
Btw, I think it's more efficient to take the clz of both halves
always, and work from that. But you'll have to benchmark that,
don't take my word for it.
Segher