lkml.org 
[lkml]   [2009]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/8] add lib/gcd.c
> 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.


\
 
 \ /
  Last update: 2009-06-13 17:31    [W:0.164 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site