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

via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 2 00:50:48 PDT 2024


https://github.com/AdvenamTacet approved this pull request.

I have no more performance concerns and LGTM % two hanging comments.

Please add to test values numbers around limits instead of only limits:
```cpp
      std::numeric_limits<Input>::min(),
      std::numeric_limits<Input>::min() + 1,
      std::numeric_limits<Input>::min() + 2,
      std::numeric_limits<Input>::max(),
      std::numeric_limits<Input>::max() - 1,
      std::numeric_limits<Input>::max() - 2,
```
could you also comment on that change:
```diff
-      return -static_cast<_Result>(__t);
+      return static_cast<_Result>(-static_cast<std::make_unsigned_t<_Result>>(__t));
```
Why that change? When does it change the result?

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


More information about the libcxx-commits mailing list