diff --git a/src/brightness/controller.rs b/src/brightness/controller.rs index b7ebbeb..6aa6b76 100644 --- a/src/brightness/controller.rs +++ b/src/brightness/controller.rs @@ -87,9 +87,9 @@ impl Controller { (_, Some(current)) if desired == current => (), (_, Some(current)) => { let step = if desired > current { - div_ceil(desired - current, TRANSITION_MAX_MS) + (desired - current).div_ceil(TRANSITION_MAX_MS) as i64 } else { - -div_ceil(current - desired, TRANSITION_MAX_MS) + -((current - desired).div_ceil(TRANSITION_MAX_MS) as i64) }; self.target = Some(Target { desired, step }); } @@ -120,10 +120,6 @@ impl Controller { } } -fn div_ceil(x: u64, y: u64) -> i64 { - ((x + y - 1) / y) as i64 -} - #[cfg(test)] mod tests { use super::*;