diff --git a/lib/libm/math.c b/lib/libm/math.c index 5e00740d10..6b65202cf0 100644 --- a/lib/libm/math.c +++ b/lib/libm/math.c @@ -48,16 +48,6 @@ float copysignf(float x, float y) { } #endif -// some compilers define log2f in terms of logf -#ifdef log2f -#undef log2f -#endif -// some compilers have _M_LN2 defined in math.h, some don't -#ifndef _M_LN2 -#define _M_LN2 (0.69314718055994530942) -#endif -float log2f(float x) { return logf(x) / (float)_M_LN2; } - static const float _M_LN10 = 2.30258509299404; // 0x40135d8e float log10f(float x) { return logf(x) / (float)_M_LN10; } diff --git a/ports/stm32/mpconfigport.h b/ports/stm32/mpconfigport.h index 7888b5355d..06606e62a1 100644 --- a/ports/stm32/mpconfigport.h +++ b/ports/stm32/mpconfigport.h @@ -335,6 +335,9 @@ static inline mp_uint_t disable_irq(void) { } while (0); #endif +// We need an implementation of the log2 function which is not a macro +#define MP_NEED_LOG2 (1) + // There is no classical C heap in bare-metal ports, only Python // garbage-collected heap. For completeness, emulate C heap via // GC heap. Note that MicroPython core never uses malloc() and friends,