[libcxx-commits] [libcxx] [libcxx] Use `lgamma` rather than `lgamma_r` with LLVM libc (PR #109556)
Petr Hosek via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Sep 21 19:12:48 PDT 2024
https://github.com/petrhosek created https://github.com/llvm/llvm-project/pull/109556
`lgamma_r` is currently only available on GPU targets.
>From a9376b92bf7373a5422ad921905ad582514aec20 Mon Sep 17 00:00:00 2001
From: Petr Hosek <phosek at google.com>
Date: Sat, 21 Sep 2024 18:51:01 -0700
Subject: [PATCH] [libcxx] Use lgamma rather than lgamma_r with LLVM libc
lgamma_r is currently only available on GPU targets.
---
libcxx/include/__random/binomial_distribution.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libcxx/include/__random/binomial_distribution.h b/libcxx/include/__random/binomial_distribution.h
index 3f19746bae238c..9538c15e2dc97b 100644
--- a/libcxx/include/__random/binomial_distribution.h
+++ b/libcxx/include/__random/binomial_distribution.h
@@ -103,7 +103,7 @@ extern "C" double lgamma_r(double, int*);
#endif
inline _LIBCPP_HIDE_FROM_ABI double __libcpp_lgamma(double __d) {
-#if defined(_LIBCPP_MSVCRT_LIKE)
+#if defined(_LIBCPP_MSVCRT_LIKE) || defined(__LLVM_LIBC__)
return lgamma(__d);
#else
int __sign;
More information about the libcxx-commits
mailing list