summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-02-21 02:31:05 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-02-21 03:26:56 +0200
commit1d30b116852cc94f3096125997c310cf64fb6537 (patch)
tree8e78423dff4ce364030ec2ad1df84d09690ec057
parentfeacaa12ac22666e4bb005cc250cc96f0be53840 (diff)
downloadmicropython-1d30b116852cc94f3096125997c310cf64fb6537.tar.gz
micropython-1d30b116852cc94f3096125997c310cf64fb6537.zip
showbc: Update for recent int varlen storage refactor.
TODO: De-duplicate DECODE_UINT, etc. definitions.
-rw-r--r--py/showbc.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/py/showbc.c b/py/showbc.c
index 837ee7611f..4bee97650a 100644
--- a/py/showbc.c
+++ b/py/showbc.c
@@ -11,10 +11,20 @@
#if MICROPY_DEBUG_PRINTERS
-#define DECODE_UINT do { unum = *ip++; if (unum > 127) { unum = ((unum & 0x3f) << 8) | (*ip++); } } while (0)
+#define DECODE_UINT { \
+ unum = 0; \
+ do { \
+ unum = (unum << 7) + (*ip & 0x7f); \
+ } while ((*ip++ & 0x80) != 0); \
+}
#define DECODE_ULABEL do { unum = (ip[0] | (ip[1] << 8)); ip += 2; } while (0)
#define DECODE_SLABEL do { unum = (ip[0] | (ip[1] << 8)) - 0x8000; ip += 2; } while (0)
-#define DECODE_QSTR do { qstr = *ip++; if (qstr > 127) { qstr = ((qstr & 0x3f) << 8) | (*ip++); } } while (0)
+#define DECODE_QSTR { \
+ qstr = 0; \
+ do { \
+ qstr = (qstr << 7) + (*ip & 0x7f); \
+ } while ((*ip++ & 0x80) != 0); \
+}
void mp_byte_code_print(const byte *ip, int len) {
const byte *ip_start = ip;