File numpy-double-double-le.patch of Package python-numpy.24870

---
 numpy/core/setup.py                       |    2 +-
 numpy/core/setup_common.py                |    4 ++++
 numpy/core/src/npymath/ieee754.c.src      |    2 +-
 numpy/core/src/npymath/npy_math_private.h |    4 ++--
 numpy/core/src/private/npy_fpmath.h       |    3 ++-
 5 files changed, 10 insertions(+), 5 deletions(-)

--- a/numpy/core/setup.py
+++ b/numpy/core/setup.py
@@ -465,7 +465,7 @@ def configuration(parent_package='',top_
                            'MOTOROLA_EXTENDED_12_BYTES_BE',
                            'IEEE_QUAD_LE', 'IEEE_QUAD_BE',
                            'IEEE_DOUBLE_LE', 'IEEE_DOUBLE_BE',
-                           'DOUBLE_DOUBLE_BE']:
+                           'DOUBLE_DOUBLE_BE', 'DOUBLE_DOUBLE_LE']:
                     moredefs.append(('HAVE_LDOUBLE_%s' % rep, 1))
                 else:
                     raise ValueError("Unrecognized long double format: %s" % rep)
--- a/numpy/core/setup_common.py
+++ b/numpy/core/setup_common.py
@@ -256,6 +256,8 @@ _IEEE_QUAD_PREC_BE = ['300', '031', '326
 _IEEE_QUAD_PREC_LE = _IEEE_QUAD_PREC_BE[::-1]
 _DOUBLE_DOUBLE_BE = ['301', '235', '157', '064', '124', '000', '000', '000'] + \
                     ['000'] * 8
+_DOUBLE_DOUBLE_LE = ['000', '000', '000', '124', '064', '157', '235', '301'] + \
+                    ['000'] * 8
 
 def long_double_representation(lines):
     """Given a binary dump as given by GNU od -b, look for long double
@@ -295,6 +297,8 @@ def long_double_representation(lines):
                         return 'IEEE_QUAD_LE'
                     elif read[8:-8] == _DOUBLE_DOUBLE_BE:
                         return 'DOUBLE_DOUBLE_BE'
+                    elif read[8:-8] == _DOUBLE_DOUBLE_LE:
+                        return 'DOUBLE_DOUBLE_LE'
                 elif read[:16] == _BEFORE_SEQ:
                     if read[16:-8] == _IEEE_DOUBLE_LE:
                         return 'IEEE_DOUBLE_LE'
--- a/numpy/core/src/npymath/ieee754.c.src
+++ b/numpy/core/src/npymath/ieee754.c.src
@@ -133,7 +133,7 @@ float _nextf(float x, int p)
     return x;
 }
 
-#ifdef HAVE_LDOUBLE_DOUBLE_DOUBLE_BE
+#if defined(HAVE_LDOUBLE_DOUBLE_DOUBLE_BE) || defined(HAVE_LDOUBLE_DOUBLE_DOUBLE_LE)
 
 /*
  * FIXME: this is ugly and untested. The asm part only works with gcc, and we
--- a/numpy/core/src/npymath/npy_math_private.h
+++ b/numpy/core/src/npymath/npy_math_private.h
@@ -435,7 +435,7 @@ do {
     typedef npy_uint32 ldouble_sign_t;
 #endif
 
-#ifndef HAVE_LDOUBLE_DOUBLE_DOUBLE_BE
+#if !defined(HAVE_LDOUBLE_DOUBLE_DOUBLE_BE) && !defined(HAVE_LDOUBLE_DOUBLE_DOUBLE_LE)
 /* Get the sign bit of x. x should be of type IEEEl2bitsrep */
 #define GET_LDOUBLE_SIGN(x) \
     (((x).a[LDBL_SIGN_INDEX] & LDBL_SIGN_MASK) >> LDBL_SIGN_SHIFT)
@@ -476,7 +476,7 @@ do {
      ((x).a[LDBL_MANH_INDEX] & ~LDBL_MANH_MASK) |                       \
      (((IEEEl2bitsrep_part)(v) << LDBL_MANH_SHIFT) & LDBL_MANH_MASK))
 
-#endif /* #ifndef HAVE_LDOUBLE_DOUBLE_DOUBLE_BE */
+#endif /* #if !defined(HAVE_LDOUBLE_DOUBLE_DOUBLE_BE) && !defined(HAVE_LDOUBLE_DOUBLE_DOUBLE_LE) */
 
 /*
  * Those unions are used to convert a pointer of npy_cdouble to native C99
--- a/numpy/core/src/private/npy_fpmath.h
+++ b/numpy/core/src/private/npy_fpmath.h
@@ -41,7 +41,8 @@
       defined(HAVE_LDOUBLE_INTEL_EXTENDED_16_BYTES_LE) || \
       defined(HAVE_LDOUBLE_INTEL_EXTENDED_12_BYTES_LE) || \
       defined(HAVE_LDOUBLE_MOTOROLA_EXTENDED_12_BYTES_BE) || \
-      defined(HAVE_LDOUBLE_DOUBLE_DOUBLE_BE))
+      defined(HAVE_LDOUBLE_DOUBLE_DOUBLE_BE) || \
+      defined(HAVE_LDOUBLE_DOUBLE_DOUBLE_LE))
     #error No long double representation defined
 #endif
 
openSUSE Build Service is sponsored by