From 7e1d891e84f58eacdb770cf9e7469e2b3d419ade Mon Sep 17 00:00:00 2001 From: "Dirk O. Kaar" Date: Tue, 28 Jan 2020 22:42:47 +0100 Subject: [PATCH] Revert to explicit calculation of modulo, saving 16 bytes in IROM. --- cores/esp8266/Print.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cores/esp8266/Print.cpp b/cores/esp8266/Print.cpp index 37259109e..c9ead745f 100644 --- a/cores/esp8266/Print.cpp +++ b/cores/esp8266/Print.cpp @@ -280,8 +280,9 @@ size_t Print::printNumber(unsigned long n, uint8_t base) { base = 10; do { - char c = n % base; + unsigned long m = n; n /= base; + char c = m - base * n; *--str = c < 10 ? c + '0' : c + 'A' - 10; } while(n); @@ -300,8 +301,9 @@ size_t Print::printNumber(unsigned long long n, uint8_t base) { base = 10; do { - char c = n % base; + unsigned long m = n; n /= base; + char c = m - base * n; *--str = c < 10 ? c + '0' : c + 'A' - 10; } while(n);