Module Name: xsrc
Committed By: christos
Date: Thu Jan 31 20:40:16 UTC 2019
Modified Files:
xsrc/external/mit/xf86-video-ati/dist/src: radeon_crtc.c
Log Message:
Taking the abs() of the difference of two unsigned numbers is probably not
what it was intended here :-)
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
xsrc/external/mit/xf86-video-ati/dist/src/radeon_crtc.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: xsrc/external/mit/xf86-video-ati/dist/src/radeon_crtc.c
diff -u xsrc/external/mit/xf86-video-ati/dist/src/radeon_crtc.c:1.3 xsrc/external/mit/xf86-video-ati/dist/src/radeon_crtc.c:1.4
--- xsrc/external/mit/xf86-video-ati/dist/src/radeon_crtc.c:1.3 Mon Dec 31 19:34:52 2018
+++ xsrc/external/mit/xf86-video-ati/dist/src/radeon_crtc.c Thu Jan 31 15:40:16 2019
@@ -245,17 +245,18 @@ RADEONComputePLL_old(RADEONPLLPtr pll,
tmp += (CARD64)pll->reference_freq * 1000 * frac_feedback_div;
current_freq = RADEONDiv(tmp, ref_div * post_div);
+#define RD_ABS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))
if (flags & RADEON_PLL_PREFER_CLOSEST_LOWER) {
error = freq - current_freq;
error = (int32_t)error < 0 ? 0xffffffff : error;
} else
- error = abs(current_freq - freq);
- vco_diff = abs(vco - best_vco);
+ error = RD_ABS(current_freq, freq);
+ vco_diff = RD_ABS(vco, best_vco);
if ((best_vco == 0 && error < best_error) ||
(best_vco != 0 &&
(error < best_error - 100 ||
- (abs(error - best_error) < 100 && vco_diff < best_vco_diff )))) {
+ (RD_ABS(error, best_error) < 100 && vco_diff < best_vco_diff )))) {
best_post_div = post_div;
best_ref_div = ref_div;
best_feedback_div = feedback_div;