Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[xsrc/trunk]: xsrc/external/mit/xf86-video-ati/dist/src Taking the abs() of t...
details: https://anonhg.NetBSD.org/xsrc/rev/6977a2e11c28
branches: trunk
changeset: 10100:6977a2e11c28
user: christos <christos%NetBSD.org@localhost>
date: Thu Jan 31 20:40:16 2019 +0000
description:
Taking the abs() of the difference of two unsigned numbers is probably not
what it was intended here :-)
diffstat:
external/mit/xf86-video-ati/dist/src/radeon_crtc.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diffs (25 lines):
diff -r f1dacf0efa69 -r 6977a2e11c28 external/mit/xf86-video-ati/dist/src/radeon_crtc.c
--- a/external/mit/xf86-video-ati/dist/src/radeon_crtc.c Thu Jan 31 19:52:31 2019 +0000
+++ b/external/mit/xf86-video-ati/dist/src/radeon_crtc.c Thu Jan 31 20:40:16 2019 +0000
@@ -245,17 +245,18 @@
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;
Home |
Main Index |
Thread Index |
Old Index