8000 Disable 3-arg pow() function on m0 boards · ehershey/circuitpython@c451b22 · GitHub
[go: up one dir, main page]

Skip to content

Commit c451b22

Browse files
committed
Disable 3-arg pow() function on m0 boards
`pow(a, b, c)` can compute `(a ** b) % c` efficiently (in time and memory). This can be useful for extremely specific applications, like implementing the RSA cryptosystem. For typical uses of CircuitPython, this is not an important feature. A survey of the bundle and learn system didn't find any uses. Disable it on M0 builds so that we can fit in needed upgrades to the USB stack.
1 parent bafa050 commit c451b22

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

ports/atmel-samd/mpconfigport.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ ifndef CIRCUITPY_AUDIOMP3
2929
CIRCUITPY_AUDIOMP3 = 0
3030
endif
3131

32+
ifndef CIRCUITPY_BUILTINS_POW3
33+
CIRCUITPY_BUILTINS_POW3 = 0
34+
endif
35+
3236
ifndef CIRCUITPY_FREQUENCYIO
3337
CIRCUITPY_FREQUENCYIO = 0
3438
endif

py/circuitpy_mpconfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ typedef long mp_off_t;
184184
// Turning off FULL_BUILD removes some functionality to reduce flash size on tiny SAMD21s
185185
#define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (CIRCUITPY_FULL_BUILD)
186186
#define MICROPY_CPYTHON_COMPAT (CIRCUITPY_FULL_BUILD)
187-
#define MICROPY_PY_BUILTINS_POW3 (CIRCUITPY_FULL_BUILD)
187+
#define MICROPY_PY_BUILTINS_POW3 (CIRCUITPY_BUILTINS_POW3)
188188
#define MICROPY_COMP_FSTRING_LITERAL (MICROPY_CPYTHON_COMPAT)
189189
#define MICROPY_MODULE_WEAK_LINKS (0)
190190
#define MICROPY_PY_ALL_SPECIAL_METHODS (CIRCUITPY_FULL_BUILD)

py/circuitpy_mpconfig.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ CFLAGS += -DCIRCUITPY_BLEIO=$(CIRCUITPY_BLEIO)
9090
CIRCUITPY_BOARD ?= 1
9191
CFLAGS += -DCIRCUITPY_BOARD=$(CIRCUITPY_BOARD)
9292

93+
CIRCUITPY_BUILTINS_POW3 ?= $(CIRCUITPY_FULL_BUILD)
94+
CFLAGS += -DCIRCUITPY_BUILTINS_POW3=$(CIRCUITPY_BUILTINS_POW3)
95+
9396
CIRCUITPY_BUSIO ?= 1
9497
CFLAGS += -DCIRCUITPY_BUSIO=$(CIRCUITPY_BUSIO)
9598

0 commit comments

Comments
 (0)
0