Re: [PATCH 1/8] add lib/gcd.c

Alan Cox
2009-06-13T15:27:47Z

> 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.