Skip to content

Commit 5b45ccf

Browse files
committed
Do not round in get_mv_rate
1 parent 9d50709 commit 5b45ccf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/me.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1506,8 +1506,9 @@ fn get_mv_rate(
15061506
) -> u32 {
15071507
#[inline(always)]
15081508
fn diff_to_rate(diff: i16, allow_high_precision_mv: bool) -> u32 {
1509-
let d = if allow_high_precision_mv { diff } else { diff / 2 };
1510-
2 * d.abs().ilog() as u32
1509+
let d =
1510+
if allow_high_precision_mv { i32::from(diff) * 2 } else { diff.into() };
1511+
d.abs().ilog() as u32
15111512
}
15121513

15131514
diff_to_rate(a.row - b.row, allow_high_precision_mv)

0 commit comments

Comments
 (0)