[PATCH xf86-video-mga] Use fabs() to compute absolute value of floating point number.

Matthieu Herrb matthieu at herrb.eu
Mon Nov 26 20:12:05 UTC 2018


Fixes a warning from clang and looks like it was a real bug.

Signed-off-by: Matthieu Herrb <matthieu at herrb.eu>
---
 src/mga_dacG.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mga_dacG.c b/src/mga_dacG.c
index 3b0d93e..5c08f8a 100644
--- a/src/mga_dacG.c
+++ b/src/mga_dacG.c
@@ -986,8 +986,8 @@ MGAGCalcClock ( ScrnInfoPtr pScrn, long f_out,
 			/*
 			 * Pick the closest frequency.
 			 */
-			if ( abs(calc_f - f_vco) < m_err ) {
-				m_err = abs(calc_f - f_vco);
+			if ( fabs(calc_f - f_vco) < m_err ) {
+				m_err = fabs(calc_f - f_vco);
 				*best_m = m;
 				*best_n = n;
 			}
-- 
2.19.1



More information about the xorg-devel mailing list