From f9058090f287b276a29a91f2630bff43a1fb50d7 Mon Sep 17 00:00:00 2001 From: Jason Smith Date: Sun, 29 Nov 2020 12:57:05 -0800 Subject: [PATCH] Fix STM32F1 'freeMemory()' warnings (#20319) --- Marlin/src/HAL/STM32F1/HAL.h | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Marlin/src/HAL/STM32F1/HAL.h b/Marlin/src/HAL/STM32F1/HAL.h index 06f75662cffa..226c8ca9b266 100644 --- a/Marlin/src/HAL/STM32F1/HAL.h +++ b/Marlin/src/HAL/STM32F1/HAL.h @@ -202,17 +202,9 @@ extern "C" { extern "C" char* _sbrk(int incr); -/* -static int freeMemory() { - volatile int top; - top = (int)((char*)&top - reinterpret_cast(_sbrk(0))); - return top; -} -*/ - -static int freeMemory() { +static inline int freeMemory() { volatile char top; - return &top - reinterpret_cast(_sbrk(0)); + return &top - _sbrk(0); } #if GCC_VERSION <= 50000