Skip to content

Commit

Permalink
use usize as type for the prio_bitmap
Browse files Browse the repository at this point in the history
- usize fits always in a register
  • Loading branch information
stlankes committed Nov 3, 2024
1 parent 70656f2 commit 7e06efa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/arch/x86/kernel/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use x86::controlregs::*;

/// Search the least significant bit
#[inline(always)]
pub(crate) fn lsb(i: u64) -> u64 {
pub(crate) fn lsb(i: usize) -> usize {
let ret;

if i == 0 {
ret = !0u64;
ret = !0usize;
} else {
unsafe {
asm!("bsf {0}, {1}",
Expand Down
4 changes: 2 additions & 2 deletions src/scheduler/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct Scheduler {
/// queue of tasks, which are ready
ready_queues: [TaskQueue; NO_PRIORITIES],
/// Bitmap to show, which queue is uesed
prio_bitmap: u64,
prio_bitmap: usize,
/// queue of tasks, which are finished and can be released
finished_tasks: VecDeque<TaskId>,
// map between task id and task controll block
Expand Down Expand Up @@ -99,7 +99,7 @@ impl Scheduler {
let i = lsb(self.prio_bitmap);
let mut task = None;

if i <= prio.into() as u64 {
if i <= prio.into().into() {
task = self.ready_queues[i as usize].pop();

// clear bitmap entry for the priority i if the queus is empty
Expand Down

0 comments on commit 7e06efa

Please sign in to comment.