[llvm] r300252 - Remove all allocation and divisions from GreatestCommonDivisor

Richard Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 11:30:47 PDT 2017


On 13 April 2017 at 13:50, Hans Wennborg <hans at chromium.org> wrote:

> On Thu, Apr 13, 2017 at 1:29 PM, Richard Smith via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
> > Author: rsmith
> > Date: Thu Apr 13 15:29:59 2017
> > New Revision: 300252
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=300252&view=rev
> > Log:
> > Remove all allocation and divisions from GreatestCommonDivisor
> >
> > Switch from Euclid's algorithm to Stein's algorithm for computing GCD.
> This
> > avoids the (expensive) APInt division operation in favour of bit
> operations.
> > Remove all memory allocation from within the GCD loop by tweaking our
> `lshr`
> > implementation so it can operate in-place.
>
> Cool!
>
> > -/// \brief Compute GCD of two APInt values.
> > +/// \brief Compute GCD of two unsigned APInt values.
> >  ///
> >  /// This function returns the greatest common divisor of the two APInt
> values
> >  /// using Euclid's algorithm.
>
> s/Euclid/Stein/ here?
>

r300728.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170419/f719b05a/attachment-0001.html>


More information about the llvm-commits mailing list