mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Made idx_for use idx_for_unchecked internally
This commit is contained in:
parent
eb2d1f3278
commit
1b5d2d468b
@ -32,10 +32,7 @@ impl<V: Vox, S: VolSize, M> Chunk<V, S, M> {
|
||||
if pos.map(|e| e >= 0).reduce_and()
|
||||
&& pos.map2(S::SIZE, |e, lim| e < lim as i32).reduce_and()
|
||||
{
|
||||
Some(
|
||||
(pos.x * S::SIZE.y as i32 * S::SIZE.z as i32 + pos.y * S::SIZE.z as i32 + pos.z)
|
||||
as usize,
|
||||
)
|
||||
Some(Self::idx_for_unchecked(pos))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ impl<V: Vox, M> Dyna<V, M> {
|
||||
#[inline(always)]
|
||||
fn idx_for(sz: Vec3<u32>, pos: Vec3<i32>) -> Option<usize> {
|
||||
if pos.map(|e| e >= 0).reduce_and() && pos.map2(sz, |e, lim| e < lim as i32).reduce_and() {
|
||||
Some((pos.x * sz.y as i32 * sz.z as i32 + pos.y * sz.z as i32 + pos.z) as usize)
|
||||
Some(Self::idx_for_unchecked(sz, pos))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user