summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-04-20 20:46:39 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-04-20 20:46:39 +0300
commit5b991ae2d3e2db32b3c77a9d140bb485a219e68d (patch)
treef6d68ad1c84ac2e7057b06b613ae2a2d0971970b
parentdde739d364b0faf48e74a88b65dc2468a3aaf64b (diff)
downloadmicropython-5b991ae2d3e2db32b3c77a9d140bb485a219e68d.tar.gz
micropython-5b991ae2d3e2db32b3c77a9d140bb485a219e68d.zip
gc: gc_realloc(): Fix byte-to-block calculation.
-rw-r--r--py/gc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/gc.c b/py/gc.c
index 2930e90110..9a5f9d89bf 100644
--- a/py/gc.c
+++ b/py/gc.c
@@ -480,7 +480,7 @@ void *gc_realloc(void *ptr_in, machine_uint_t n_bytes) {
}
// compute number of new blocks that are requested
- machine_uint_t new_blocks = (n_bytes + BYTES_PER_BLOCK) / BYTES_PER_BLOCK;
+ machine_uint_t new_blocks = (n_bytes + BYTES_PER_BLOCK - 1) / BYTES_PER_BLOCK;
// get the number of consecutive tail blocks and
// the number of free blocks after last tail block