mirror of
https://github.com/micropython/micropython.git
synced 2025-09-08 02:40:55 +02:00
Double precision math library and support on pyboard, and improved ussl This release brings general improvements and bug fixes to the core and various ports, as well as documentation additions, clean-ups and better consistency. And effort has been made to clean up the source code to make it more consistent across the core and all ports. There is a new tool "mpy_bin2res.py" to convert arbitrary (binary) files to Python resources for inclusion in source code (frozen or otherwise). The ussl module has seen improvements, including implementation of server_hostname (for axtls) and server_side mode (for mbedtls). There is now a double-precision float math library and stmhal has support to build firmware with software or hardware double-precision. A detailed list of changes follows. py core: - formatfloat: fix number of digits and exponent sign when rounding - modthread: raise RuntimeError in release() if lock is not acquired - compile: raise SyntaxError if positional args are given after */** - objint: support "big" byte-order in int.to_bytes() - objint: in to_bytes(), allow length arg to be any int and check sign - compile: fix bug with break/continue in else of optimised for-range - compile: optimise emitter label indices to save a word of heap - builtinimport: remove unreachable code for relative imports - objnamedtuple: simplify and remove use of alloca building namedtuple - mpprint: remove unreachable check for neg return of mp_format_float - binary: add missing "break" statements - runtime: mark m_malloc_fail() as NORETURN - objstr: remove unnecessary "sign" variable in formatting code - vm: make "if" control flow more obvious in YIELD_FROM opcode - modmath: check for zero division in log with 2 args - makeversionhdr.py: update to parse new release line in docs/conf.py - objdict: factorise dict accessor helper to reduce code size - change mp_uint_t to size_t in builtins code - repl: change mp_uint_t to size_t in repl helpers - compile: combine arith and bit-shift ops into 1 compile routine - compile: use switch-case to match token and operator - objgenerator: allow to hash generators and generator instances - gc: refactor assertions in gc_free function - vm: make n_state variable local to just set-up part of VM - asmx64: support moving a 64-bit immediate to one of top 8 registers - modmicropython: cast stack_limit value so it prints correctly - builtinevex: add typechecking of globals/locals args to eval/exec - py.mk: make berkeley-db C-defs apply only to relevant source files - mperrno: allow mperrno.h to be correctly included before other hdrs - mpz: make mpz_is_zero() an inline function - implement raising a big-int to a negative power - mkrules.mk: show frozen modules sizes together with executable size - objtuple: allow to use inplace-multiplication operator on tuples - objstr: raise an exception for wrong type on RHS of str binary op - modsys: initial implementation of sys.getsizeof() - binary.c: fix bug when packing big-endian 'Q' values - add verbose debug compile-time flag MICROPY_DEBUG_VERBOSE - binary: change internal bytearray typecode from 0 to 1 - objstringio: prevent offset wraparound for io.BytesIO objects - objstringio: fix regression with handling SEEK_SET - stream: seek: Consistently handle negative offset for SEEK_SET - mkrules.mk: use "find -path" when searching for frozen obj files - compile: remove unused pn_colon code when compiling func params - objcomplex: remove unnecessary assignment of variable - formatfloat: don't post-increment variable that won't be used again - use "static inline" for funcs that should be inline - asmthumb: use existing macro to properly clear the D-cache extmod: - modussl_axtls: update for axTLS 2.1.3 - modussl_axtls: implement server_hostname arg to wrap_socket() - move modonewire.c from esp8266 to extmod directory - modure: if input string is bytes, return bytes results too - modubinascii: add check for empty buffer passed to hexlify - modussl_axtls: allow to close ssl stream multiple times - modussl_mbedtls: support server_side mode - modussl_mbedtls: when reading and peer wants to close, return 0 - modframebuf: fix invalid stride for odd widths in GS4_HMSB fmt - modussl_mbedtls: make socket.close() free all TLS resources - modframebuf: consistently use "col" as name for colour variables - modussl_mbedtls: implement non-blocking SSL sockets - machine_signal: fix parsing of invert arg when Pin is first arg - modframebuf: use correct initialization for .locals_dict - modlwip: implement setsockopt(IP_ADD_MEMBERSHIP) - modussl_mbedtls.c: add ussl.getpeercert() method - modubinascii: rewrite mod_binascii_a2b_base64 - modubinascii: don't post-increment variable that won't be used - modonewire: rename public module to mp_module_onewire - for uos.stat interpret st_size member as an unsigned int - use "static inline" for funcs that should be inline lib: - axtls: upgrade to axTLS 2.1.3 + MicroPython patchset - libm/math: remove implementations of float conversion functions - add libm_dbl, a double-precision math library, from musl-1.1.16 drivers: - onewire: move onewire.py, ds18x20.py from esp8266 to drivers - onewire: enable pull-up when init'ing the 1-wire pin tools: - gen-cpydiff: use case description as 3rd-level heading - pyboard: add license header - mpy_bin2res: tools to convert binary resources to Python module - mpy-tool.py: don't generate const_table if it's empty - mpy-tool.py: fix missing argument in dump() function tests: - net_inet/test_tls_sites.py: integration test for SSL connections - net_inet: add tests for accept and connect in nonblocking mode - basics: add tests for for-else statement - net_inet: move tests which don't require full Internet to net_hosted - connect_nonblock: refactor towards real net_hosted test - auto detect floating point capabilites of the target - import: add a test for the builtin __import__ function - import: update comment now that uPy raises correct exception - basics/namedtuple1: add test for creating with pos and kw args - unix/extra_coverage: add test for mp_vprintf with bad fmt spec - basics: add tests for arithmetic operators precedence - cpydiff/modules_deque: elaborate workaround - cpydiff/core_class_mro: move under Classes, add workaround - cpydiff/core_arguments: move under Functions subsection - cpydiff/core_class_supermultiple: same cause as core_class_mro - cpydiff: improve wording, add more workarounds - cpydiff: add case for str.ljust/rjust - rename exec1.py to builtin_exec.py - basics/builtin_exec: test various globals/locals args to exec() minimal port: - Makefile: enable gc-sections to remove unused code - remove unused stmhal include from Makefile - use size_t for mp_builtin_open argument unix port: - modtime: replace strftime() with localtime() - mpconfigport.mk: update descriptions of readline and TLS options - Makefile: disable assertions in the standard unix executable - modjni: convert to mp_rom_map_elem_t - for uos.stat interpret st_size member as an unsigned int stmhal port: - mpconfigport.h: remove config of PY_THREAD_GIL to use default - make error messages more consistent across peripherals - add initial implementation of Pin.irq() method - add .value() method to Switch object, to mirror Pin and Signal - move pybstdio.c to lib/utils/sys_stdio_mphal.c for common use - add "quiet timing" enter/exit functions - make available the _onewire module, for low-level bus control - modules: provide sym-link to onewire.py driver - boards/stm32f405.ld: increase FLASH_TEXT to end of 1MiB flash - sdcard: allow a board to customise the SDIO pins - add possibility to build with double-precision floating point - boards: enable double-prec FP on F76x boards - Makefile: use hardware double-prec FP for MCUs that support it - Makefile: rename FLOAT_IMPL to MICROPY_FLOAT_IMPL to match C name - Makefile: add CFLAGS_EXTRA to CFLAGS so cmdline can add options - mpconfigport.h: allow MICROPY_PY_THREAD to be overridden - boards: add configuration files for NUCLEO_F429ZI - boards/NUCLEO_F429ZI: change USB config from HS to FS peripheral - reduce size of ESPRUINO_PICO build so it fits in flash - servo: make pyb.Servo(n) map to Pin('Xn') on all MCUs - servo: don't compile servo code when it's not enabled - use "static inline" for funcs that should be inline cc3200 port: - modusocket: simplify socket.makefile() function - make non-zero socket timeout work with connect/accept/send - modusocket: fix connect() when in non-blocking or timeout mode - use the name MicroPython consistently in code esp8266 port: - Makefile: bump axTLS TLS record buffer size to 5K - Makefile: allow FROZEN_DIR,FROZEN_MPY_DIR to be overridden - Makefile: add LIB_SRC_C variable to qstr auto-extraction list - make onewire module and support code usable by other ports - modonewire: move low-level 1-wire bus code to modonewire.c - modonewire: make timings static and remove onewire.timings func - reinstate 1-wire scripts by sym-linking to drivers/onewire/ - move mp_hal_pin_open_drain from esp_mphal.c to machine_pin.c - enable MICROPY_ENABLE_FINALISER - README: make "Documentation" a top-level section - machine_rtc: use correct arithmetic for aligning RTC mem len - mpconfigport_512k: use terse error messages to get 512k to fit - mpconfigport.h: make socket a weak link - modesp: remove unused constants: STA_MODE, etc - general: add known issue of WiFi RX buffers overflow - use size_t for mp_builtin_open argument - fix UART stop bit constants zephyr port: - Makefile: rework dependencies and "clean" target - Makefile: revert prj.conf construction rule to the previous state - remove long-obsolete machine_ptr_t typedef's - Makefile: explicitly define default target as "all" - modusocket: allow to use socketized net_context in upstream - modusocket: socket, close: switch to native Zephyr socket calls - modusocket: bind, connect, listen, accept: Swtich to native sockets - modusocket: send: switch to native sockets - modusocket: recv: switch to native sockets - modusocket: fully switch to native Zephyr sockets - modzephyr: add current_tid() and stacks_analyze() functions - prj_base.conf: enable CONFIG_INIT_STACKS - modusocket: update struct sockaddr family field name - prj_96b_carbon.conf: re-enable networking on Carbon - modzephyr: add shell_net_iface() function docs: - btree: add hints about opening db file and need to flush db - select: rename to uselect, to match the actual module name - license: update copyright year - esp8266/tutorial/intro: discourage use of 512kb firmwares - esp8266/tutorial/intro: Sphinx requires blank lines around literal blocks - conf.py: include 3 levels of ToC in latexpdf output - gc: mark mem_alloc()/mem_free() as uPy-specific - gc: document gc.threshold() function - builtins: list builtin exceptions - conf.py: set default_role = 'any' - lcd160cr: group related constants together and use full sentences - ref/speed_python: update and make more hardware-neutral - library/gc: fix grammar and improve readability of gc.threshold() - move all ports docs to the single ToC - topindex.html: remove link to wipy.io, it's no longer available - conf.py: add .venv dir to exclude_patterns - move topindex.html to templates/ subdir - differences/index_template: use consistent heading casing - builtins: add AssertionError, SyntaxError, ZeroDivisionError - add glossary - conf.py: switch to "new" format of intersphinx_mapping - conf.py: add file for global replacements definition - library: add CPython docs xref to each pertinent module - replace.inc: add |see_cpython|, to xref individual symbols from CPython - conf.py: set "version" and "release" to the same value - *_index: drop "Indices and tables" pseudo-section - pyboard: move hardware info into General Info chapter - uerrno: document "uerrno" module - esp8266/general.rst: fix name of NTP module - pyboard: move info about using Windows from topindex to general - uzlib: update description of decompress() and mention DecompIO - pyboard/tutorial/amp_skin: add example for playing large WAV files - library/ubinascii: update base64 docs - library/usocket: move socket.error to its own section - library/usocket: describe complete information on address formats - glossary: elaborate on possible MicroPython port differences - glossary: fix typos in micropython-lib paragraph - index: rewrite introduction paragraph to avoid confusion - use the name MicroPython consistently in documentation - consistently link to micropython-lib in glossary all: - make more use of mp_raise_{msg,TypeError,ValueError} helpers - unify header guard usage - remove trailing spaces, per coding conventions - don't include system errno.h when it's not needed - use the name MicroPython consistently in comments - make use of $(TOP) variable in Makefiles, instead of ".." - raise exceptions via mp_raise_XXX - make static dicts use mp_rom_map_elem_t type and MP_ROM_xxx macros README: - mention support for bytecode and frozen bytecode - improve description of precompiled bytecode; mention mpy-cross CODECONVENTIONS: - clarify MicroPython changes sign-off process - start to describe docs conventions - describe docs use of markup for None/True/False travis: - build STM32F769DISC board instead of F7DISC to test dbl-prec FP - pin cpp-coveralls at 0.3.12
228 lines
8.9 KiB
C
228 lines
8.9 KiB
C
/*
|
|
* This file is part of the MicroPython project, http://micropython.org/
|
|
*
|
|
* The MIT License (MIT)
|
|
*
|
|
* Copyright (c) 2013, 2014 Damien P. George
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
* in the Software without restriction, including without limitation the rights
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
* furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
* THE SOFTWARE.
|
|
*/
|
|
#ifndef MICROPY_INCLUDED_PY_MISC_H
|
|
#define MICROPY_INCLUDED_PY_MISC_H
|
|
|
|
// a mini library of useful types and functions
|
|
|
|
/** types *******************************************************/
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
|
|
typedef unsigned char byte;
|
|
typedef unsigned int uint;
|
|
|
|
/** generic ops *************************************************/
|
|
|
|
#ifndef MIN
|
|
#define MIN(x, y) ((x) < (y) ? (x) : (y))
|
|
#endif
|
|
#ifndef MAX
|
|
#define MAX(x, y) ((x) > (y) ? (x) : (y))
|
|
#endif
|
|
|
|
// Classical double-indirection stringification of preprocessor macro's value
|
|
#define _MP_STRINGIFY(x) #x
|
|
#define MP_STRINGIFY(x) _MP_STRINGIFY(x)
|
|
|
|
/** memory allocation ******************************************/
|
|
|
|
// TODO make a lazy m_renew that can increase by a smaller amount than requested (but by at least 1 more element)
|
|
|
|
#define m_new(type, num) ((type*)(m_malloc(sizeof(type) * (num))))
|
|
#define m_new_maybe(type, num) ((type*)(m_malloc_maybe(sizeof(type) * (num))))
|
|
#define m_new0(type, num) ((type*)(m_malloc0(sizeof(type) * (num))))
|
|
#define m_new_obj(type) (m_new(type, 1))
|
|
#define m_new_obj_maybe(type) (m_new_maybe(type, 1))
|
|
#define m_new_obj_var(obj_type, var_type, var_num) ((obj_type*)m_malloc(sizeof(obj_type) + sizeof(var_type) * (var_num)))
|
|
#define m_new_obj_var_maybe(obj_type, var_type, var_num) ((obj_type*)m_malloc_maybe(sizeof(obj_type) + sizeof(var_type) * (var_num)))
|
|
#if MICROPY_ENABLE_FINALISER
|
|
#define m_new_obj_with_finaliser(type) ((type*)(m_malloc_with_finaliser(sizeof(type))))
|
|
#else
|
|
#define m_new_obj_with_finaliser(type) m_new_obj(type)
|
|
#endif
|
|
#if MICROPY_MALLOC_USES_ALLOCATED_SIZE
|
|
#define m_renew(type, ptr, old_num, new_num) ((type*)(m_realloc((ptr), sizeof(type) * (old_num), sizeof(type) * (new_num))))
|
|
#define m_renew_maybe(type, ptr, old_num, new_num, allow_move) ((type*)(m_realloc_maybe((ptr), sizeof(type) * (old_num), sizeof(type) * (new_num), (allow_move))))
|
|
#define m_del(type, ptr, num) m_free(ptr, sizeof(type) * (num))
|
|
#define m_del_var(obj_type, var_type, var_num, ptr) (m_free(ptr, sizeof(obj_type) + sizeof(var_type) * (var_num)))
|
|
#else
|
|
#define m_renew(type, ptr, old_num, new_num) ((type*)(m_realloc((ptr), sizeof(type) * (new_num))))
|
|
#define m_renew_maybe(type, ptr, old_num, new_num, allow_move) ((type*)(m_realloc_maybe((ptr), sizeof(type) * (new_num), (allow_move))))
|
|
#define m_del(type, ptr, num) ((void)(num), m_free(ptr))
|
|
#define m_del_var(obj_type, var_type, var_num, ptr) ((void)(var_num), m_free(ptr))
|
|
#endif
|
|
#define m_del_obj(type, ptr) (m_del(type, ptr, 1))
|
|
|
|
void *m_malloc(size_t num_bytes);
|
|
void *m_malloc_maybe(size_t num_bytes);
|
|
void *m_malloc_with_finaliser(size_t num_bytes);
|
|
void *m_malloc0(size_t num_bytes);
|
|
#if MICROPY_MALLOC_USES_ALLOCATED_SIZE
|
|
void *m_realloc(void *ptr, size_t old_num_bytes, size_t new_num_bytes);
|
|
void *m_realloc_maybe(void *ptr, size_t old_num_bytes, size_t new_num_bytes, bool allow_move);
|
|
void m_free(void *ptr, size_t num_bytes);
|
|
#else
|
|
void *m_realloc(void *ptr, size_t new_num_bytes);
|
|
void *m_realloc_maybe(void *ptr, size_t new_num_bytes, bool allow_move);
|
|
void m_free(void *ptr);
|
|
#endif
|
|
NORETURN void *m_malloc_fail(size_t num_bytes);
|
|
|
|
#if MICROPY_MEM_STATS
|
|
size_t m_get_total_bytes_allocated(void);
|
|
size_t m_get_current_bytes_allocated(void);
|
|
size_t m_get_peak_bytes_allocated(void);
|
|
#endif
|
|
|
|
/** array helpers ***********************************************/
|
|
|
|
// get the number of elements in a fixed-size array
|
|
#define MP_ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
|
|
|
// align ptr to the nearest multiple of "alignment"
|
|
#define MP_ALIGN(ptr, alignment) (void*)(((uintptr_t)(ptr) + ((alignment) - 1)) & ~((alignment) - 1))
|
|
|
|
/** unichar / UTF-8 *********************************************/
|
|
|
|
#if MICROPY_PY_BUILTINS_STR_UNICODE
|
|
// with unicode enabled we need a type which can fit chars up to 0x10ffff
|
|
typedef uint32_t unichar;
|
|
#else
|
|
// without unicode enabled we can only need to fit chars up to 0xff
|
|
// (on 16-bit archs uint is 16-bits and more efficient than uint32_t)
|
|
typedef uint unichar;
|
|
#endif
|
|
|
|
unichar utf8_get_char(const byte *s);
|
|
const byte *utf8_next_char(const byte *s);
|
|
|
|
bool unichar_isspace(unichar c);
|
|
bool unichar_isalpha(unichar c);
|
|
bool unichar_isprint(unichar c);
|
|
bool unichar_isdigit(unichar c);
|
|
bool unichar_isxdigit(unichar c);
|
|
bool unichar_isident(unichar c);
|
|
bool unichar_isupper(unichar c);
|
|
bool unichar_islower(unichar c);
|
|
unichar unichar_tolower(unichar c);
|
|
unichar unichar_toupper(unichar c);
|
|
mp_uint_t unichar_xdigit_value(unichar c);
|
|
mp_uint_t unichar_charlen(const char *str, mp_uint_t len);
|
|
#define UTF8_IS_NONASCII(ch) ((ch) & 0x80)
|
|
#define UTF8_IS_CONT(ch) (((ch) & 0xC0) == 0x80)
|
|
|
|
/** variable string *********************************************/
|
|
|
|
typedef struct _vstr_t {
|
|
size_t alloc;
|
|
size_t len;
|
|
char *buf;
|
|
bool fixed_buf : 1;
|
|
} vstr_t;
|
|
|
|
// convenience macro to declare a vstr with a fixed size buffer on the stack
|
|
#define VSTR_FIXED(vstr, alloc) vstr_t vstr; char vstr##_buf[(alloc)]; vstr_init_fixed_buf(&vstr, (alloc), vstr##_buf);
|
|
|
|
void vstr_init(vstr_t *vstr, size_t alloc);
|
|
void vstr_init_len(vstr_t *vstr, size_t len);
|
|
void vstr_init_fixed_buf(vstr_t *vstr, size_t alloc, char *buf);
|
|
struct _mp_print_t;
|
|
void vstr_init_print(vstr_t *vstr, size_t alloc, struct _mp_print_t *print);
|
|
void vstr_clear(vstr_t *vstr);
|
|
vstr_t *vstr_new(size_t alloc);
|
|
void vstr_free(vstr_t *vstr);
|
|
static inline void vstr_reset(vstr_t *vstr) { vstr->len = 0; }
|
|
static inline char *vstr_str(vstr_t *vstr) { return vstr->buf; }
|
|
static inline size_t vstr_len(vstr_t *vstr) { return vstr->len; }
|
|
void vstr_hint_size(vstr_t *vstr, size_t size);
|
|
char *vstr_extend(vstr_t *vstr, size_t size);
|
|
char *vstr_add_len(vstr_t *vstr, size_t len);
|
|
char *vstr_null_terminated_str(vstr_t *vstr);
|
|
void vstr_add_byte(vstr_t *vstr, byte v);
|
|
void vstr_add_char(vstr_t *vstr, unichar chr);
|
|
void vstr_add_str(vstr_t *vstr, const char *str);
|
|
void vstr_add_strn(vstr_t *vstr, const char *str, size_t len);
|
|
char *vstr_ins_blank_bytes(vstr_t *vstr, size_t byte_pos, size_t byte_len);
|
|
void vstr_ins_byte(vstr_t *vstr, size_t byte_pos, byte b);
|
|
void vstr_ins_char(vstr_t *vstr, size_t char_pos, unichar chr);
|
|
void vstr_cut_head_bytes(vstr_t *vstr, size_t bytes_to_cut);
|
|
void vstr_cut_tail_bytes(vstr_t *vstr, size_t bytes_to_cut);
|
|
void vstr_cut_out_bytes(vstr_t *vstr, size_t byte_pos, size_t bytes_to_cut);
|
|
void vstr_printf(vstr_t *vstr, const char *fmt, ...);
|
|
|
|
/** non-dynamic size-bounded variable buffer/string *************/
|
|
|
|
#define CHECKBUF(buf, max_size) char buf[max_size + 1]; size_t buf##_len = max_size; char *buf##_p = buf;
|
|
#define CHECKBUF_RESET(buf, max_size) buf##_len = max_size; buf##_p = buf;
|
|
#define CHECKBUF_APPEND(buf, src, src_len) \
|
|
{ size_t l = MIN(src_len, buf##_len); \
|
|
memcpy(buf##_p, src, l); \
|
|
buf##_len -= l; \
|
|
buf##_p += l; }
|
|
#define CHECKBUF_APPEND_0(buf) { *buf##_p = 0; }
|
|
#define CHECKBUF_LEN(buf) (buf##_p - buf)
|
|
|
|
#ifdef va_start
|
|
void vstr_vprintf(vstr_t *vstr, const char *fmt, va_list ap);
|
|
#endif
|
|
|
|
// Debugging helpers
|
|
int DEBUG_printf(const char *fmt, ...);
|
|
|
|
extern mp_uint_t mp_verbose_flag;
|
|
|
|
// This is useful for unicode handling. Some CPU archs has
|
|
// special instructions for efficient implementation of this
|
|
// function (e.g. CLZ on ARM).
|
|
// NOTE: this function is unused at the moment
|
|
#ifndef count_lead_ones
|
|
static inline mp_uint_t count_lead_ones(byte val) {
|
|
mp_uint_t c = 0;
|
|
for (byte mask = 0x80; val & mask; mask >>= 1) {
|
|
c++;
|
|
}
|
|
return c;
|
|
}
|
|
#endif
|
|
|
|
/** float internals *************/
|
|
|
|
#if MICROPY_PY_BUILTINS_FLOAT
|
|
#if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_DOUBLE
|
|
#define MP_FLOAT_EXP_BITS (11)
|
|
#define MP_FLOAT_FRAC_BITS (52)
|
|
#elif MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT
|
|
#define MP_FLOAT_EXP_BITS (8)
|
|
#define MP_FLOAT_FRAC_BITS (23)
|
|
#endif
|
|
#define MP_FLOAT_EXP_BIAS ((1 << (MP_FLOAT_EXP_BITS - 1)) - 1)
|
|
#endif // MICROPY_PY_BUILTINS_FLOAT
|
|
|
|
#endif // MICROPY_INCLUDED_PY_MISC_H
|