From 211cbfe66078f0cc47ef76a5aaad1e3c2bf8f7b0 Mon Sep 17 00:00:00 2001 From: Luc Mcgrady Date: Mon, 1 Sep 2025 05:16:40 +0100 Subject: [PATCH] Fix/Simulator intervals decending overflows (#4275) * Fix/Simulator intervals decending overflows * saturating_sub * oops --- rslib/src/scheduler/fsrs/simulator.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rslib/src/scheduler/fsrs/simulator.rs b/rslib/src/scheduler/fsrs/simulator.rs index 005f7ca86..b18e86a77 100644 --- a/rslib/src/scheduler/fsrs/simulator.rs +++ b/rslib/src/scheduler/fsrs/simulator.rs @@ -97,7 +97,7 @@ fn create_review_priority_fn( // Interval-based ordering IntervalsAscending => wrap!(|c, _w| c.interval as i32), - IntervalsDescending => wrap!(|c, _w| -(c.interval as i32)), + IntervalsDescending => wrap!(|c, _w| (c.interval as i32).saturating_neg()), // Retrievability-based ordering RetrievabilityAscending => { wrap!(move |c, w| (c.retrievability(w) * 1000.0) as i32)