From e77a9510505081895e0e8cc3083a6285fb28271f Mon Sep 17 00:00:00 2001 From: Giovanni Bruno Date: Wed, 15 Apr 2026 12:24:58 +0200 Subject: [PATCH] fixed overflow in map --- api/Common.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/Common.cpp b/api/Common.cpp index 8299247a..2b2906ce 100644 --- a/api/Common.cpp +++ b/api/Common.cpp @@ -22,7 +22,7 @@ /* C++ prototypes */ long map(long x, long in_min, long in_max, long out_min, long out_max) { - return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; + return (long)((long long)(x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min); } uint16_t makeWord(uint16_t w) { return w; }