[libcxx-commits] [PATCH] D145982: [libc++] Implement std::gcd using the binary version

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 3 13:43:17 PDT 2023


philnik added inline comments.


================
Comment at: libcxx/include/__bit/countr.h:28
 int __libcpp_ctz(unsigned __x)           _NOEXCEPT { return __builtin_ctz(__x); }
 
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
----------------
Please add the benchmarks under `libcxx/benchmarks/`.


================
Comment at: libcxx/include/__numeric/gcd_lcm.h:54
 
-
-template<class _Tp>
-_LIBCPP_CONSTEXPR _LIBCPP_HIDDEN
-_Tp __gcd(_Tp __m, _Tp __n)
-{
+template <class _Tp>
+_LIBCPP_CONSTEXPR _LIBCPP_HIDDEN _Tp __gcd(_Tp __a, _Tp __b) {
----------------
Could you add a short comment explaining how the algorithm works?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145982/new/

https://reviews.llvm.org/D145982



More information about the libcxx-commits mailing list