[PATCH] D18639: Use __builtin_isnan/isinf/isfinite in complex

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 21 06:58:13 PDT 2016


mclow.lists added a comment.

Maybe something like this? (untested)

  template <class _A1>
  _LIBCPP_ALWAYS_INLINE
  typename std::enable_if<!std::is_floating_point<_A1>::value, bool>::type
  __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
  {
      return isfinite(__lcpp_x);
  }
  
  template <class _A1>
  _LIBCPP_ALWAYS_INLINE
  typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
  __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
  {
  #if __has_builtin(__builtin_isfinite)
      return __builtin_isfinite(__lcpp_x);
  #else
      return isfinite(__lcpp_x);
  #endif
  }


https://reviews.llvm.org/D18639





More information about the cfe-commits mailing list