summaryrefslogtreecommitdiffstatshomepage
path: root/py/pfenv.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-04-01 20:18:14 +0100
committerDamien George <damien.p.george@gmail.com>2014-04-01 20:18:14 +0100
commit256afcf9f62f181bb16d1e407da6d7fbc03a759b (patch)
tree0c588c26d2d3300c41036568ac22d646a4f3bba9 /py/pfenv.c
parent380cc53bd91c1ca9bf990185287c99e68b4ec744 (diff)
parent80359aa96e87141c5ab842c0fd501646baa1050c (diff)
downloadmicropython-256afcf9f62f181bb16d1e407da6d7fbc03a759b.tar.gz
micropython-256afcf9f62f181bb16d1e407da6d7fbc03a759b.zip
Merge pull request #411 from dhylands/pfenv-64-bit
Fix INT_BUF_SIZE to work with 32-bit and 64-bit
Diffstat (limited to 'py/pfenv.c')
-rw-r--r--py/pfenv.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/py/pfenv.c b/py/pfenv.c
index 07f35c335c..018870158e 100644
--- a/py/pfenv.c
+++ b/py/pfenv.c
@@ -71,8 +71,9 @@ int pfenv_print_strn(const pfenv_t *pfenv, const char *str, unsigned int len, in
return len;
}
-// enough room for 32 signed number
-#define INT_BUF_SIZE (16)
+// 32-bits is 10 digits, add 3 for commas, 1 for sign, 1 for terminating null
+// We can use 16 characters for 32-bit and 32 characters for 64-bit
+#define INT_BUF_SIZE (sizeof(machine_int_t) * 4)
int pfenv_print_int(const pfenv_t *pfenv, unsigned int x, int sgn, int base, int base_char, int flags, char fill, int width) {
char sign = 0;