[libcxx-commits] [libcxx] [libc++] Implement std::gcd using the binary version (PR #77747)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jan 12 02:48:57 PST 2024
================
@@ -39,7 +41,7 @@ struct __ct_abs<_Result, _Source, true> {
if (__t >= 0)
return __t;
if (__t == numeric_limits<_Source>::min())
- return -static_cast<_Result>(__t);
+ return static_cast<_Result>(-static_cast<std::make_unsigned_t<_Result>>(__t));
----------------
AdvenamTacet wrote:
Please, add a comment explaining why it's done that way.
https://github.com/llvm/llvm-project/pull/77747
More information about the libcxx-commits
mailing list