summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/include/numpy/npy_cpu.h2
-rw-r--r--numpy/core/include/numpy/npy_endian.h3
-rw-r--r--numpy/core/setup.py1
-rw-r--r--numpy/core/setup_common.py4
-rw-r--r--numpy/core/src/npymath/npy_math_private.h39
-rw-r--r--numpy/core/src/private/npy_fpmath.h1
6 files changed, 49 insertions, 1 deletions
diff --git a/numpy/core/include/numpy/npy_cpu.h b/numpy/core/include/numpy/npy_cpu.h
index 9707a7adf..ab14731b8 100644
--- a/numpy/core/include/numpy/npy_cpu.h
+++ b/numpy/core/include/numpy/npy_cpu.h
@@ -68,6 +68,8 @@
#define NPY_CPU_MIPSEB
#elif defined(__aarch64__)
#define NPY_CPU_AARCH64
+#elif defined(__mc68000__)
+ #define NPY_CPU_M68K
#else
#error Unknown CPU, please report this to numpy maintainers with \
information about your platform (OS, CPU and compiler)
diff --git a/numpy/core/include/numpy/npy_endian.h b/numpy/core/include/numpy/npy_endian.h
index 4e3349ffe..36d09232f 100644
--- a/numpy/core/include/numpy/npy_endian.h
+++ b/numpy/core/include/numpy/npy_endian.h
@@ -36,7 +36,8 @@
|| defined(NPY_CPU_PPC64) \
|| defined(NPY_CPU_ARMEB) \
|| defined(NPY_CPU_SH_BE) \
- || defined(NPY_CPU_MIPSEB)
+ || defined(NPY_CPU_MIPSEB) \
+ || defined(NPY_CPU_M68K)
#define NPY_BYTE_ORDER NPY_BIG_ENDIAN
#else
#error Unknown CPU: can not set endianness
diff --git a/numpy/core/setup.py b/numpy/core/setup.py
index b48414c2d..05e20a09a 100644
--- a/numpy/core/setup.py
+++ b/numpy/core/setup.py
@@ -456,6 +456,7 @@ def configuration(parent_package='',top_path=None):
rep = check_long_double_representation(config_cmd)
if rep in ['INTEL_EXTENDED_12_BYTES_LE',
'INTEL_EXTENDED_16_BYTES_LE',
+ 'MOTOROLA_EXTENDED_12_BYTES_BE',
'IEEE_QUAD_LE', 'IEEE_QUAD_BE',
'IEEE_DOUBLE_LE', 'IEEE_DOUBLE_BE',
'DOUBLE_DOUBLE_BE']:
diff --git a/numpy/core/setup_common.py b/numpy/core/setup_common.py
index cb30c83c9..9f745e965 100644
--- a/numpy/core/setup_common.py
+++ b/numpy/core/setup_common.py
@@ -242,6 +242,8 @@ _INTEL_EXTENDED_12B = ['000', '000', '000', '000', '240', '242', '171', '353',
'031', '300', '000', '000']
_INTEL_EXTENDED_16B = ['000', '000', '000', '000', '240', '242', '171', '353',
'031', '300', '000', '000', '000', '000', '000', '000']
+_MOTOROLA_EXTENDED_12B = ['300', '031', '000', '000', '353', '171',
+ '242', '240', '000', '000', '000', '000']
_IEEE_QUAD_PREC_BE = ['300', '031', '326', '363', '105', '100', '000', '000',
'000', '000', '000', '000', '000', '000', '000', '000']
_IEEE_QUAD_PREC_LE = _IEEE_QUAD_PREC_BE[::-1]
@@ -275,6 +277,8 @@ def long_double_representation(lines):
if read[:12] == _BEFORE_SEQ[4:]:
if read[12:-8] == _INTEL_EXTENDED_12B:
return 'INTEL_EXTENDED_12_BYTES_LE'
+ if read[12:-8] == _MOTOROLA_EXTENDED_12B:
+ return 'MOTOROLA_EXTENDED_12_BYTES_BE'
elif read[:8] == _BEFORE_SEQ[8:]:
if read[8:-8] == _INTEL_EXTENDED_16B:
return 'INTEL_EXTENDED_16_BYTES_LE'
diff --git a/numpy/core/src/npymath/npy_math_private.h b/numpy/core/src/npymath/npy_math_private.h
index 722d03f94..c6f11f854 100644
--- a/numpy/core/src/npymath/npy_math_private.h
+++ b/numpy/core/src/npymath/npy_math_private.h
@@ -250,6 +250,45 @@ do { \
typedef npy_uint32 ldouble_man_t;
typedef npy_uint32 ldouble_exp_t;
typedef npy_uint32 ldouble_sign_t;
+#elif defined(HAVE_LDOUBLE_MOTOROLA_EXTENDED_12_BYTES_BE)
+ /*
+ * Motorola extended 80 bits precision. Bit representation is
+ * | s |eeeeeeeeeeeeeee| junk |mmmmmmmm................mmmmmmm|
+ * | 1 bit | 15 bits | 16 bits| 64 bits |
+ * | a[0] | a[1] | a[2] |
+ *
+ * 16 low bits of a[0] are junk
+ */
+ typedef npy_uint32 IEEEl2bitsrep_part;
+
+/* my machine */
+
+ union IEEEl2bitsrep {
+ npy_longdouble e;
+ IEEEl2bitsrep_part a[3];
+ };
+
+ #define LDBL_MANL_INDEX 2
+ #define LDBL_MANL_MASK 0xFFFFFFFF
+ #define LDBL_MANL_SHIFT 0
+
+ #define LDBL_MANH_INDEX 1
+ #define LDBL_MANH_MASK 0xFFFFFFFF
+ #define LDBL_MANH_SHIFT 0
+
+ #define LDBL_EXP_INDEX 0
+ #define LDBL_EXP_MASK 0x7FFF0000
+ #define LDBL_EXP_SHIFT 16
+
+ #define LDBL_SIGN_INDEX 0
+ #define LDBL_SIGN_MASK 0x80000000
+ #define LDBL_SIGN_SHIFT 31
+
+ #define LDBL_NBIT 0x80000000
+
+ typedef npy_uint32 ldouble_man_t;
+ typedef npy_uint32 ldouble_exp_t;
+ typedef npy_uint32 ldouble_sign_t;
#elif defined(HAVE_LDOUBLE_IEEE_DOUBLE_16_BYTES_BE) || \
defined(HAVE_LDOUBLE_IEEE_DOUBLE_BE)
/* 64 bits IEEE double precision aligned on 16 bytes: used by ppc arch on
diff --git a/numpy/core/src/private/npy_fpmath.h b/numpy/core/src/private/npy_fpmath.h
index 92338e4c7..8a120cab7 100644
--- a/numpy/core/src/private/npy_fpmath.h
+++ b/numpy/core/src/private/npy_fpmath.h
@@ -40,6 +40,7 @@
defined(HAVE_LDOUBLE_IEEE_DOUBLE_16_BYTES_BE) || \
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))
#error No long double representation defined
#endif