From 6862781b073137a9cf6dc4e0a49a020da013d8ee Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Thu, 14 Apr 2022 07:03:14 +0500 Subject: [PATCH] Final warning fixes --- src/device/hwm_gl518sm.c | 3 +-- src/include/86box/86box.h | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/device/hwm_gl518sm.c b/src/device/hwm_gl518sm.c index 4afe016f2..102026294 100644 --- a/src/device/hwm_gl518sm.c +++ b/src/device/hwm_gl518sm.c @@ -31,8 +31,7 @@ #define CLAMP(a, min, max) (((a) < (min)) ? (min) : (((a) > (max)) ? (max) : (a))) /* Formulas and factors derived from Linux's gl518sm.c driver. */ -#define GL518SM_RPMDIV(r, d) (CLAMP((r), 1, 960000) * (d)) -#define GL518SM_RPM_TO_REG(r, d) ((r) ? CLAMP((480000 + GL518SM_RPMDIV(r, d) / 2) / GL518SM_RPMDIV(r, d), 1, 255) : 0) +#define GL518SM_RPM_TO_REG(r, d) ((r) ? CLAMP((480000 + (r) * (d) / 2) / (r) * (d), 1, 255) : 0) #define GL518SM_VOLTAGE_TO_REG(v) ((uint8_t) round((v) / 19.0)) #define GL518SM_VDD_TO_REG(v) ((uint8_t) (((v) * 4) / 95.0)) diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index 110a9d3d4..8b84100fd 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -42,6 +42,9 @@ #ifdef MAX #undef MAX #endif +#ifdef ABS +#undef ABS +#endif #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b))