From f6a799c7b382f43e819fa4bd7ffd618bca09236e Mon Sep 17 00:00:00 2001
From: Marcio T <mlt4356-github@yahoo.com>
Date: Thu, 24 Oct 2019 13:57:20 -0600
Subject: [PATCH] Allow compile under Windows Subsystem for Linux (#15606)

---
 Marlin/src/HAL/HAL_AVR/HAL.h | 8 ++++++++
 Marlin/src/core/macros.h     | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/Marlin/src/HAL/HAL_AVR/HAL.h b/Marlin/src/HAL/HAL_AVR/HAL.h
index 246353677f..e83176918c 100644
--- a/Marlin/src/HAL/HAL_AVR/HAL.h
+++ b/Marlin/src/HAL/HAL_AVR/HAL.h
@@ -38,6 +38,14 @@
 #include <avr/interrupt.h>
 #include <avr/io.h>
 
+#ifndef pgm_read_ptr
+  // Compatibility for avr-libc 1.8.0-4.1 included with Ubuntu for
+  // Windows Subsystem for Linux on Windows 10 as of 10/18/2019
+  #define pgm_read_ptr_far(address_long) (void*)__ELPM_word((uint32_t)(address_long)) 
+  #define pgm_read_ptr_near(address_short) (void*)__LPM_word((uint16_t)(address_short))
+  #define pgm_read_ptr(address_short) pgm_read_ptr_near(address_short)
+#endif
+
 // ------------------------
 // Defines
 // ------------------------
diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h
index b93bae79f6..03deea89dc 100644
--- a/Marlin/src/core/macros.h
+++ b/Marlin/src/core/macros.h
@@ -279,7 +279,7 @@
 #define ATAN2(y, x) atan2f(y, x)
 #define POW(x, y)   powf(x, y)
 #define SQRT(x)     sqrtf(x)
-#define RSQRT(x)    (1 / sqrtf(x))
+#define RSQRT(x)    (1.0f / sqrtf(x))
 #define CEIL(x)     ceilf(x)
 #define FLOOR(x)    floorf(x)
 #define LROUND(x)   lroundf(x)
-- 
GitLab