]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/python/src/numpy/dtype.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / python / src / numpy / dtype.cpp
index 13904ddde3d8df5ec45bbd270c4ecd3dfda1147f..88a20a27b5f240d9730479b48023f211736139b5 100644 (file)
 #include <boost/python/numpy/internal.hpp>
 
 #define DTYPE_FROM_CODE(code) \
-    dtype(python::detail::new_reference(reinterpret_cast<PyObject*>(PyArray_DescrFromType(code))))
+  dtype(python::detail::new_reference(reinterpret_cast<PyObject*>(PyArray_DescrFromType(code))))
 
 #define BUILTIN_INT_DTYPE(bits)                                         \
-    template <> struct builtin_int_dtype< bits, false > {               \
-        static dtype get() { return DTYPE_FROM_CODE(NPY_INT ## bits); } \
-    };                                                                  \
-    template <> struct builtin_int_dtype< bits, true > {                \
-        static dtype get() { return DTYPE_FROM_CODE(NPY_UINT ## bits); } \
-    };                                                                  \
-    template dtype get_int_dtype< bits, false >();                      \
-    template dtype get_int_dtype< bits, true >()
+  template <> struct builtin_int_dtype<bits, false>                    \
+  {                                                                    \
+    static dtype get() { return DTYPE_FROM_CODE(NPY_INT ## bits);}     \
+  };                                                                   \
+  template <> struct builtin_int_dtype<bits, true>                     \
+  {                                                                    \
+    static dtype get() { return DTYPE_FROM_CODE(NPY_UINT ## bits);}    \
+  };                                                                   \
+  template BOOST_NUMPY_DECL dtype get_int_dtype<bits, false>();                \
+  template BOOST_NUMPY_DECL dtype get_int_dtype<bits, true>()
 
 #define BUILTIN_FLOAT_DTYPE(bits)                                       \
-    template <> struct builtin_float_dtype< bits > {                    \
-        static dtype get() { return DTYPE_FROM_CODE(NPY_FLOAT ## bits); } \
-    };                                                                  \
-    template dtype get_float_dtype< bits >()
+  template <> struct builtin_float_dtype<bits>                         \
+  {                                                                    \
+    static dtype get() { return DTYPE_FROM_CODE(NPY_FLOAT ## bits);}   \
+  };                                                                   \
+  template BOOST_NUMPY_DECL dtype get_float_dtype<bits>()
 
 #define BUILTIN_COMPLEX_DTYPE(bits)                                     \
-    template <> struct builtin_complex_dtype< bits > {                  \
-        static dtype get() { return DTYPE_FROM_CODE(NPY_COMPLEX ## bits); } \
-    };                                                                  \
-    template dtype get_complex_dtype< bits >()
+  template <> struct builtin_complex_dtype<bits>                       \
+  {                                                                    \
+    static dtype get() { return DTYPE_FROM_CODE(NPY_COMPLEX ## bits);} \
+  };                                                                   \
+  template BOOST_NUMPY_DECL dtype get_complex_dtype<bits>()
 
 namespace boost { namespace python { namespace converter {
 NUMPY_OBJECT_MANAGER_TRAITS_IMPL(PyArrayDescr_Type, numpy::dtype)
@@ -58,7 +62,9 @@ BUILTIN_INT_DTYPE(8);
 BUILTIN_INT_DTYPE(16);
 BUILTIN_INT_DTYPE(32);
 BUILTIN_INT_DTYPE(64);
+#ifdef NPY_FLOAT16
 BUILTIN_FLOAT_DTYPE(16);
+#endif
 BUILTIN_FLOAT_DTYPE(32);
 BUILTIN_FLOAT_DTYPE(64);
 BUILTIN_COMPLEX_DTYPE(64);