From daf273e75095a79bc1619994cbe97862a245a8df Mon Sep 17 00:00:00 2001 From: s-t-a-n <31728406+s-t-a-n@users.noreply.github.com> Date: Sun, 17 Jan 2021 18:37:46 +0100 Subject: [PATCH 1/2] Replaced 'int' type with 'intptr_t' type in pointer arithmetic for compiling without -fpermisive --- MemoryFree.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/MemoryFree.cpp b/MemoryFree.cpp index bf57184..e7f0f0b 100644 --- a/MemoryFree.cpp +++ b/MemoryFree.cpp @@ -4,6 +4,8 @@ #include #endif +#include + extern unsigned int __heap_start; extern void *__brkval; @@ -39,13 +41,13 @@ int freeListSize() int freeMemory() { int free_memory; - if ((int)__brkval == 0) + if ((intptr_t)__brkval == 0) { - free_memory = ((int)&free_memory) - ((int)&__heap_start); + free_memory = ((intptr_t)&free_memory) - ((intptr_t)&__heap_start); } else { - free_memory = ((int)&free_memory) - ((int)__brkval); + free_memory = ((intptr_t)&free_memory) - ((intptr_t)__brkval); free_memory += freeListSize(); } return free_memory; From 3b3b632a8661a3612982d9f69e7b1ddbd8f55b50 Mon Sep 17 00:00:00 2001 From: s-t-a-n <31728406+s-t-a-n@users.noreply.github.com> Date: Mon, 1 Feb 2021 22:13:52 +0100 Subject: [PATCH 2/2] Updated README.md to reflect changes made to repo --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 527f486..a48b462 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,4 @@ This is the excellent MemoryFree library from http://www.arduino.cc/playground/C I am hosting it here so there is a quick and easy way to pull it down. (20 Mar 2015) Repository updated with code from http://playground.arduino.cc/code/AvailableMemory +(17 Jan 2021) Replaced 'int' type with 'intptr_t' type in pointer arithmetic for compiling without -fpermisive