[libcxx-commits] [libcxx] [libc++] Fix sub-overflow in std::gcd implementation (PR #117984)
via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Nov 28 02:16:03 PST 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 2fe947b47798de1ad20553be4e162e332428ad91 6c58c296fff586959505b2ffcc5747ebc2cefead --extensions h -- libcxx/include/__numeric/gcd_lcm.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/include/__numeric/gcd_lcm.h b/libcxx/include/__numeric/gcd_lcm.h
index 99565218e6..371ca30129 100644
--- a/libcxx/include/__numeric/gcd_lcm.h
+++ b/libcxx/include/__numeric/gcd_lcm.h
@@ -76,7 +76,7 @@ constexpr _LIBCPP_HIDDEN _Tp __gcd(_Tp __a, _Tp __b) {
if (__a == 0)
return __b;
- _Tp __c = __a | __b;
+ _Tp __c = __a | __b;
int __shift = std::__countr_zero(__c);
__a >>= std::__countr_zero(__a);
do {
``````````
</details>
https://github.com/llvm/llvm-project/pull/117984
More information about the libcxx-commits
mailing list