diff --git a/core/src/ui/holds.rs b/core/src/ui/holds.rs index bafeea2..975bc8b 100644 --- a/core/src/ui/holds.rs +++ b/core/src/ui/holds.rs @@ -64,11 +64,12 @@ impl Holds { let half_rel = REL_SHIFT - 1; let lo = ((self.lo.raw() as i64 - px) * 2 - 3) << half_rel; let hi = ((self.hi.raw() as i64 - px) * 2 + 3) << half_rel; - let (a, b) = (div_toward(lo, rel, true), div_toward(hi, rel, false)); - let (c, d) = (div_toward(lo, rel, false), div_toward(hi, rel, true)); + // Dividing by a negative turns the ends around, so which end each + // bound comes from is decided before dividing rather than by taking + // the min and max of four divisions. match rel > 0 { - true => Self::raws(a, b), - false => Self::raws(d, c), + true => Self::raws(div_toward(lo, rel, true), div_toward(hi, rel, false)), + false => Self::raws(div_toward(hi, rel, true), div_toward(lo, rel, false)), } }