Skip to content

Commit

Permalink
no compact and unchecked math
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoqun committed Sep 18, 2024
1 parent 28a6784 commit 0ce5514
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions unified-scheduler-logic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,13 @@ mod utils {

#[must_use]
pub(super) fn increment(self) -> Self {
Self(self.0.checked_add(1).unwrap())
//Self(self.0.checked_add(1).unwrap())
Self(self.0 + 1)
}

#[must_use]
pub(super) fn decrement(self) -> Self {
Self(self.0.checked_sub(1).unwrap())
Self(self.0 - 1)
}

pub(super) fn increment_self(&mut self) -> &mut Self {
Expand Down Expand Up @@ -551,7 +552,7 @@ use std::collections::BinaryHeap;
#[derive(Debug)]
struct UsageQueueInner {
current_usage: Option<Usage>,
blocked_usages_from_tasks2: BinaryHeap<Compact<UsageFromTask3>>,
blocked_usages_from_tasks2: BinaryHeap<UsageFromTask3>,
}

use enum_ptr::EnumPtr;
Expand Down Expand Up @@ -707,15 +708,15 @@ impl UsageQueueInner {
}

fn first_blocked_task_index(&self) -> Option<Index> {
self.blocked_usages_from_tasks2.peek().map(|uft| uft.map_ref(|u| u.index()))
self.blocked_usages_from_tasks2.peek().map(|uft| uft.index())
}

#[must_use]
fn pop_buffered_readonly_usage_from_task(&mut self) -> Option<UsageFromTask3> {
if matches!(
self.blocked_usages_from_tasks2
.peek()
.map(|uft| uft.map_ref(|u| u.usage())),
.map(|uft| uft.usage()),
Some(RequestedUsage::Readonly)
) {
assert_matches!(self.current_usage, Some(Usage::Readonly(_)));
Expand Down

0 comments on commit 0ce5514

Please sign in to comment.