summaryrefslogtreecommitdiff
path: root/py/mpconfig.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-07-20 11:03:13 +0000
committerDamien George <damien.p.george@gmail.com>2015-07-20 11:03:13 +0000
commitc3bd9415cc8e6ba3619fe4b7a2bdac20260b0236 (patch)
treef18830095cdda64cfdfc6e164ec88d3442e85c6c /py/mpconfig.h
parent1e8ca3a3cf442733f9210be4d5f6a5b63135a16d (diff)
py: Make qstr hash size configurable, defaults to 2 bytes.
This patch makes configurable, via MICROPY_QSTR_BYTES_IN_HASH, the number of bytes used for a qstr hash. It was originally fixed at 2 bytes, and now defaults to 2 bytes. Setting it to 1 byte will save ROM and RAM at a small expense of hash collisions.
Diffstat (limited to 'py/mpconfig.h')
-rw-r--r--py/mpconfig.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h
index 0b86ec435..9f0e909f5 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -152,6 +152,11 @@
#define MICROPY_QSTR_BYTES_IN_LEN (1)
#endif
+// Number of bytes used to store qstr hash
+#ifndef MICROPY_QSTR_BYTES_IN_HASH
+#define MICROPY_QSTR_BYTES_IN_HASH (2)
+#endif
+
// Avoid using C stack when making Python function calls. C stack still
// may be used if there's no free heap.
#ifndef MICROPY_STACKLESS