Re: [PATCH 1/8] add lib/gcd.c
From: Alan Cox
Date: Sat Jun 13 2009 - 11:27:50 EST
> Would the binary gcd algorithm not be a better fit for the kernel?
>
> It avoids division, using only shifts and subtraction:
Time them both and see. I suspect on a lot of processors the divide based
one now wins. We also have fls() and ffs() which may mean some platforms
can implement the first two loops even better.
Could well be the shift based one is better for some processors only.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/