From 7cd81c7d178387113e3a575accb4cba48dfd337d Mon Sep 17 00:00:00 2001 From: JS Deck Date: Wed, 14 Feb 2024 11:55:28 -0400 Subject: [PATCH] Correct math --- source/nwm_rs/src/entries/thread_screen/safe_impl.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/nwm_rs/src/entries/thread_screen/safe_impl.rs b/source/nwm_rs/src/entries/thread_screen/safe_impl.rs index d125afc..141e13e 100644 --- a/source/nwm_rs/src/entries/thread_screen/safe_impl.rs +++ b/source/nwm_rs/src/entries/thread_screen/safe_impl.rs @@ -313,8 +313,8 @@ pub fn thread_screen_loop(sync: ScreenEncodeSync) -> Option<()> { }; let factor = [get_factor(false), get_factor(true)]; - if factor[false as usize] < vars.priority_factor_scaled() - && factor[true as usize] < vars.priority_factor_scaled() + if factor[false as usize] < (1 << SCALE_BITS) + && factor[true as usize] < (1 << SCALE_BITS) { *vars.frame_queue(false) += vars.priority_factor_scaled(); *vars.frame_queue(true) += vars.priority_factor_scaled(); @@ -328,7 +328,7 @@ pub fn thread_screen_loop(sync: ScreenEncodeSync) -> Option<()> { let s = is_top; let mut try_dequeue = |b| -> bool { - if *vars.frame_queue(b) > prio[b as usize] { + if *vars.frame_queue(b) >= prio[b as usize] { if vars.port_screen_sync(b, false) { is_top = b; *vars.frame_queue(b) -= prio[b as usize]; @@ -348,7 +348,7 @@ pub fn thread_screen_loop(sync: ScreenEncodeSync) -> Option<()> { if let Some(s) = vars.port_screens_sync() { is_top = s; - if *vars.frame_queue(is_top) > prio[is_top as usize] { + if *vars.frame_queue(is_top) >= prio[is_top as usize] { *vars.frame_queue(is_top) -= prio[is_top as usize]; } else { *vars.frame_queue(is_top) = 0;