diff options
-rw-r--r-- | numpy/core/include/numpy/npy_cpu.h | 2 | ||||
-rw-r--r-- | numpy/core/include/numpy/npy_endian.h | 3 | ||||
-rw-r--r-- | numpy/core/setup.py | 1 | ||||
-rw-r--r-- | numpy/core/setup_common.py | 4 | ||||
-rw-r--r-- | numpy/core/src/npymath/npy_math_private.h | 39 | ||||
-rw-r--r-- | numpy/core/src/private/npy_fpmath.h | 1 | ||||
-rw-r--r-- | numpy/distutils/log.py | 21 |
7 files changed, 64 insertions, 7 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..2bca6bf60 100644 --- a/numpy/core/src/npymath/npy_math_private.h +++ b/numpy/core/src/npymath/npy_math_private.h @@ -185,7 +185,6 @@ do { \ */ typedef npy_uint32 IEEEl2bitsrep_part; -/* my machine */ union IEEEl2bitsrep { npy_longdouble e; @@ -250,6 +249,44 @@ 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; + + + 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 diff --git a/numpy/distutils/log.py b/numpy/distutils/log.py index 2f801a732..d77f98c63 100644 --- a/numpy/distutils/log.py +++ b/numpy/distutils/log.py @@ -7,9 +7,11 @@ from distutils.log import Log as old_Log from distutils.log import _global_log if sys.version_info[0] < 3: - from .misc_util import red_text, default_text, cyan_text, green_text, is_sequence, is_string + from .misc_util import (red_text, default_text, cyan_text, green_text, + is_sequence, is_string) else: - from numpy.distutils.misc_util import red_text, default_text, cyan_text, green_text, is_sequence, is_string + from numpy.distutils.misc_util import (red_text, default_text, cyan_text, + green_text, is_sequence, is_string) def _fix_args(args,flag=1): @@ -19,6 +21,7 @@ def _fix_args(args,flag=1): return tuple([_fix_args(a,flag=0) for a in args]) return args + class Log(old_Log): def _log(self, level, msg, args): if level >= self.threshold: @@ -33,8 +36,10 @@ class Log(old_Log): sys.stdout.flush() def good(self, msg, *args): - """If we'd log WARN messages, log this message as a 'nice' anti-warn + """ + If we log WARN messages, log this message as a 'nice' anti-warn message. + """ if WARN >= self.threshold: if args: @@ -42,6 +47,8 @@ class Log(old_Log): else: print(green_text(msg)) sys.stdout.flush() + + _global_log.__class__ = Log good = _global_log.good @@ -53,11 +60,14 @@ def set_threshold(level, force=False): # likely a good reason why we're running at this level. _global_log.threshold = level if level <= DEBUG: - info('set_threshold: setting thershold to DEBUG level, it can be changed only with force argument') + info('set_threshold: setting threshold to DEBUG level,' + ' it can be changed only with force argument') else: - info('set_threshold: not changing thershold from DEBUG level %s to %s' % (prev_level,level)) + info('set_threshold: not changing threshold from DEBUG level' + ' %s to %s' % (prev_level, level)) return prev_level + def set_verbosity(v, force=False): prev_level = _global_log.threshold if v < 0: @@ -70,6 +80,7 @@ def set_verbosity(v, force=False): set_threshold(DEBUG, force) return {FATAL:-2,ERROR:-1,WARN:0,INFO:1,DEBUG:2}.get(prev_level,1) + _global_color_map = { DEBUG:cyan_text, INFO:default_text, |