diff --git a/libs/core/core.cpp b/libs/core/core.cpp index 1dabda5f..a4d083da 100644 --- a/libs/core/core.cpp +++ b/libs/core/core.cpp @@ -224,7 +224,8 @@ namespace pxt { uint32_t afterProgramPage() { uint32_t ptr = (uint32_t)&bytecode[0]; ptr += programSize(); - ptr = (ptr + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1); + if (ptr % PAGE_SIZE != 0) + ptr = (ptr & ~(PAGE_SIZE-1)) + PAGE_SIZE; return ptr; } }