fix(pathops): M2.1: keep Fenwick indices Rust 1.95 compatible

This commit is contained in:
Cédric Legrand committed 2026-10-31 20:29:10 +01:00
1 parent e04c5d2274
commit f137e9df9a
2 files changed
+8 -2

No files matched your search

+2 -2
View File
@@ -112,7 +112,7 @@ impl Fenwick {
let mut i = rank + 1;
while let Some(c) = self.0.get_mut(i) {
*c += by;
i += i.isolate_lowest_one();
i += i & i.wrapping_neg();
}
}
@@ -123,7 +123,7 @@ impl Fenwick {
&& let Some(c) = self.0.get(i)
{
n += c;
i -= i.isolate_lowest_one();
i -= i & i.wrapping_neg();
}
u64::try_from(n).unwrap_or(0)
}
+6
View File
@@ -93,3 +93,9 @@ fn a_fold_stops_once_it_has_swept_its_budget() {
assert_eq!(steps, MAX_FOLD_SEGMENTS / 100_004);
assert_eq!(budget.spend(&BezPath::new(), &BezPath::new()), Err(PathOpsError::TooComplex), "spent stays spent");
}
#[test]
fn overlapping_rectangle_bounds_count_self_and_cross_pairs() {
let shapes = rects([Rect::new(0.0, 0.0, 2.0, 2.0), Rect::new(1.0, 1.0, 3.0, 3.0), Rect::new(4.0, 4.0, 5.0, 5.0)]);
assert_eq!(complexity([&shapes]), Some(Complexity { segments: 12, crossings: 14 }));
}