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

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jan 11 06:56:08 PST 2024


================
@@ -48,6 +49,24 @@ constexpr bool test0(int in1, int in2, int out)
     return true;
 }
 
+template <typename T>
+T basic_gcd(T m, T n) {
+  return n == 0 ? m : basic_gcd<T>(n, m % n);
+}
+
+template <typename Input>
+void do_fuzzy_tests() {
+  std::random_device rd;
+  std::mt19937 gen(rd());
----------------
AdvenamTacet wrote:

Let's change it to a fixed seed instead `std::random_device`, so a potential error is reproducible.

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


More information about the libcxx-commits mailing list