Changeset View
Changeset View
Standalone View
Standalone View
libcxx/include/__cmath/isfinite.h
- This file was added.
//===----------------------------------------------------------------------===// | |||||
// | |||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | |||||
// See https://llvm.org/LICENSE.txt for license information. | |||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | |||||
// | |||||
//===----------------------------------------------------------------------===// | |||||
#ifndef _LIBCPP___CMATH_ISFINITE_H | |||||
#define _LIBCPP___CMATH_ISFINITE_H | |||||
#include <__config> | |||||
#include <__type_traits/enable_if.h> | |||||
#include <__type_traits/is_arithmetic.h> | |||||
#include <limits> | |||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | |||||
# pragma GCC system_header | |||||
#endif | |||||
template <class _Tp, | |||||
std::__enable_if_t< std::is_arithmetic<_Tp>::value && std::numeric_limits<_Tp>::has_infinity, int> = 0> | |||||
inline _LIBCPP_HIDE_FROM_ABI bool isfinite(_Tp __lcpp_x) _NOEXCEPT { | |||||
return __builtin_isfinite(__lcpp_x); | |||||
} | |||||
template <class _Tp, | |||||
std::__enable_if_t< std::is_arithmetic<_Tp>::value && !std::numeric_limits<_Tp>::has_infinity, int> = 0> | |||||
inline _LIBCPP_HIDE_FROM_ABI bool isfinite(_Tp) _NOEXCEPT { | |||||
return true; | |||||
} | |||||
#endif // _LIBCPP___CMATH_ISFINITE_H |