[libcxx-commits] [libcxx] [libc++] Implement std::gcd using the binary version (PR #77747)

Daniel Lemire via libcxx-commits libcxx-commits at lists.llvm.org
Mon Apr 22 12:10:45 PDT 2024


lemire wrote:

Note that my statement is not meant to contradict @AdvenamTacet but to point out that you can actually bound the difference from first principles. Algorithmically speaking, the difference cannot be excessively large, especially because each step in the binary GCD is cheaper. So it is definitively true that the naive algorithm can be sometimes faster, but there is denial-of-service attack lurking. :-)

https://github.com/llvm/llvm-project/pull/77747


More information about the libcxx-commits mailing list