summaryrefslogtreecommitdiffstats
path: root/contrib/python/pythran/pythran/pythonic/include/numpy/signbit.hpp
blob: ba75d802b0e14019962940e69f4b612c7cb9169c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef PYTHONIC_INCLUDE_NUMPY_SIGNBIT_HPP
#define PYTHONIC_INCLUDE_NUMPY_SIGNBIT_HPP

#include "pythonic/include/types/ndarray.hpp"
#include "pythonic/include/utils/functor.hpp"
#include "pythonic/include/utils/numpy_traits.hpp"

#include <xsimd/xsimd.hpp>

PYTHONIC_NS_BEGIN

namespace numpy
{

  namespace details
  {
    template <class T>
    auto signbit(T val) -> decltype(xsimd::signbit(val) == T(1))
    {
      return xsimd::signbit(val) == T(1);
    }
  } // namespace details

#define NUMPY_NARY_FUNC_NAME signbit
#define NUMPY_NARY_FUNC_SYM details::signbit
#include "pythonic/include/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END

#endif