Skip to content

Commit

Permalink
Update size_hint for Evoxels.
Browse files Browse the repository at this point in the history
Should have been in 57c383d.
  • Loading branch information
kpreid committed Aug 6, 2024
1 parent edd476a commit db4350f
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions all-is-cubes/src/block/eval/voxel_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,21 @@ impl<'a> arbitrary::Arbitrary<'a> for Evoxels {
}

fn size_hint(depth: usize) -> (usize, Option<usize>) {
arbitrary::size_hint::and_all(&[
use crate::math::GridCoordinate;

let max_data_size = GridAab::for_block(Resolution::MAX).volume().unwrap()
* Evoxel::size_hint(depth).1.unwrap();

arbitrary::size_hint::and(
Resolution::size_hint(depth),
arbitrary::size_hint::or(
Evoxel::size_hint(depth),
Vol::<Arc<[Evoxel]>>::size_hint(depth),
Evoxel::size_hint(depth), // single-voxel case
arbitrary::size_hint::and(
(3, Some(size_of::<GridCoordinate>() * 6)), // variable size of bounds choice
(0, Some(max_data_size)), // data
),
),
])
)
}
}

Expand Down

0 comments on commit db4350f

Please sign in to comment.