Skip to content

Commit

Permalink
[boost] Workaround for Apple Silicon
Browse files Browse the repository at this point in the history
  • Loading branch information
wistaria committed Aug 22, 2024
1 parent c85a62c commit 872b189
Showing 1 changed file with 32 additions and 26 deletions.
58 changes: 32 additions & 26 deletions tools/boost/patch/boost-1.86.0.patch
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
diff -crN boost_1_86_0.orig/libs/python/src/numpy/dtype.cpp boost_1_86_0/libs/python/src/numpy/dtype.cpp
*** boost_1_86_0.orig/libs/python/src/numpy/dtype.cpp Thu Aug 8 07:07:40 2024
--- boost_1_86_0/libs/python/src/numpy/dtype.cpp Thu Aug 22 00:41:23 2024
***************
*** 98,104 ****
return python::detail::new_reference(reinterpret_cast<PyObject*>(obj));
}

! int dtype::get_itemsize() const { return reinterpret_cast<PyArray_Descr*>(ptr())->elsize;}

bool equivalent(dtype const & a, dtype const & b) {
// On Windows x64, the behaviour described on
--- 98,110 ----
return python::detail::new_reference(reinterpret_cast<PyObject*>(obj));
}

! int dtype::get_itemsize() const {
! #if NPY_ABI_VERSION < 0x02000000
! return reinterpret_cast<PyArray_Descr*>(ptr())->elsize;
! #else
! return PyDataType_ELSIZE(reinterpret_cast<PyArray_Descr*>(ptr()));
! #endif
! }

bool equivalent(dtype const & a, dtype const & b) {
// On Windows x64, the behaviour described on
diff -urN boost-1.86.0.orig/libs/charconv/src/to_chars_float_impl.hpp boost-1.86.0/libs/charconv/src/to_chars_float_impl.hpp
--- boost-1.86.0.orig/libs/charconv/src/to_chars_float_impl.hpp 2024-08-08 07:07:34
+++ boost-1.86.0/libs/charconv/src/to_chars_float_impl.hpp 2024-08-22 10:23:38
@@ -273,9 +273,7 @@

typename std::conditional<std::is_same<Real, float>::value, ieee754_binary32,
typename std::conditional<std::is_same<Real, double>::value, ieee754_binary64,
- #ifdef BOOST_CHARCONV_HAS_FLOAT128
- typename std::conditional<std::is_same<Real, __float128>::value || BOOST_CHARCONV_LDBL_BITS == 128, ieee754_binary128, ieee754_binary80>::type
- #elif BOOST_CHARCONV_LDBL_BITS == 128
+ #if BOOST_CHARCONV_LDBL_BITS == 128
ieee754_binary128
#elif BOOST_CHARCONV_LDBL_BITS == 80
ieee754_binary80
diff -urN boost-1.86.0.orig/libs/python/src/numpy/dtype.cpp boost-1.86.0/libs/python/src/numpy/dtype.cpp
--- boost-1.86.0.orig/libs/python/src/numpy/dtype.cpp 2024-08-08 07:07:40
+++ boost-1.86.0/libs/python/src/numpy/dtype.cpp 2024-08-22 10:20:27
@@ -98,7 +98,13 @@
return python::detail::new_reference(reinterpret_cast<PyObject*>(obj));
}

-int dtype::get_itemsize() const { return reinterpret_cast<PyArray_Descr*>(ptr())->elsize;}
+int dtype::get_itemsize() const {
+#if NPY_ABI_VERSION < 0x02000000
+ return reinterpret_cast<PyArray_Descr*>(ptr())->elsize;
+#else
+ return PyDataType_ELSIZE(reinterpret_cast<PyArray_Descr*>(ptr()));
+#endif
+}

bool equivalent(dtype const & a, dtype const & b) {
// On Windows x64, the behaviour described on

0 comments on commit 872b189

Please sign in to comment.