mirror of
https://github.com/storytold/figcraft.git
synced 2026-11-08 19:42:05 +00:00
fix(pathops): M2.1: keep Fenwick indices Rust 1.95 compatible
This commit is contained in:
1 parent
e04c5d2274
commit
f137e9df9a
2 files changed
+8
-2
No files matched your search
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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 }));
|
||||
}
|
||||
Reference in new issue
Block a user