Skip to content

Commit

Permalink
Correct math
Browse files Browse the repository at this point in the history
  • Loading branch information
xzn committed Feb 14, 2024
1 parent 3b0139d commit 7cd81c7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions source/nwm_rs/src/entries/thread_screen/safe_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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];
Expand All @@ -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;
Expand Down

0 comments on commit 7cd81c7

Please sign in to comment.