From 572e96ba03522cfb822b13fe4abb50e857a5de48 Mon Sep 17 00:00:00 2001 From: "sorokin.oleg.edu" Date: Thu, 24 Sep 2026 20:29:46 -0700 Subject: [PATCH] Use standard parity and saturating generation operations --- crates/oa-desktop/src/behavior/topology/removal_input.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/oa-desktop/src/behavior/topology/removal_input.rs b/crates/oa-desktop/src/behavior/topology/removal_input.rs index c7b599d5..276fd8aa 100644 --- a/crates/oa-desktop/src/behavior/topology/removal_input.rs +++ b/crates/oa-desktop/src/behavior/topology/removal_input.rs @@ -15,7 +15,7 @@ impl Lifetime { /// Even generations are idle; odd generations belong to one live gesture. pub(super) fn idle(&self) -> Option { let generation = self.0.load(Ordering::SeqCst); - (generation % 2 == 0).then_some(generation) + generation.is_multiple_of(2).then_some(generation) } /// Retire an idle packet at a native input boundary (including the @@ -23,7 +23,7 @@ impl Lifetime { pub(super) fn revoke_idle(&self) { if let Some(generation) = self.idle() { // Keep overflow terminal and unavailable rather than reusing zero. - let next = generation.checked_add(2).unwrap_or(u64::MAX); + let next = generation.saturating_add(2); let _ = self .0 .compare_exchange(generation, next, Ordering::SeqCst, Ordering::SeqCst);