From: Justin Lebar Date: Sat, 11 Nov 2017 01:25:44 +0000 (+0000) Subject: [CUDA] Fix std::min on device side to return the min, not the max. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3d47fbe0d75b2d1bb5353cc73a9484502860b571;p=clang [CUDA] Fix std::min on device side to return the min, not the max. Summary: How embarrassing. This is tested in the test-suite -- fix to come there in a separate patch. Reviewers: tra Subscribers: sanjoy, cfe-commits Differential Revision: https://reviews.llvm.org/D39817 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317961 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Headers/cuda_wrappers/algorithm b/lib/Headers/cuda_wrappers/algorithm index 95d9beb73c..cedd70762c 100644 --- a/lib/Headers/cuda_wrappers/algorithm +++ b/lib/Headers/cuda_wrappers/algorithm @@ -80,7 +80,7 @@ min(const __T &__a, const __T &__b, __Cmp __cmp) { template inline __device__ const __T & min(const __T &__a, const __T &__b) { - return __a < __b ? __b : __a; + return __a < __b ? __a : __b; } #ifdef _LIBCPP_END_NAMESPACE_STD