py/binary: Support half-float 'e' format in struct pack/unpack.
This commit implements the 'e' half-float format: 10-bit mantissa, 5-bit exponent. It uses native _Float16 if supported by the compiler, otherwise uses custom bitshifting encoding/decoding routines. Signed-off-by: Matthias Urlichs <matthias@urlichs.de> Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
committed by
Damien George
parent
77f08b72ca
commit
e520fa2e0f
@@ -830,6 +830,15 @@ typedef double mp_float_t;
|
||||
#define MICROPY_PY_BUILTINS_COMPLEX (MICROPY_PY_BUILTINS_FLOAT)
|
||||
#endif
|
||||
|
||||
// Whether to use the native _Float16 for 16-bit float support
|
||||
#ifndef MICROPY_FLOAT_USE_NATIVE_FLT16
|
||||
#ifdef __FLT16_MAX__
|
||||
#define MICROPY_FLOAT_USE_NATIVE_FLT16 (1)
|
||||
#else
|
||||
#define MICROPY_FLOAT_USE_NATIVE_FLT16 (0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Whether to provide a high-quality hash for float and complex numbers.
|
||||
// Otherwise the default is a very simple but correct hashing function.
|
||||
#ifndef MICROPY_FLOAT_HIGH_QUALITY_HASH
|
||||
|
||||
Reference in New Issue
Block a user