From d7d51e1810e1622b7ea24163b99c882b3731190c Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Thu, 6 Jun 2019 07:42:59 +0100 Subject: [PATCH] Made idx_for use idx_for_unchecked internally --- common/src/volumes/chunk.rs | 5 +---- common/src/volumes/dyna.rs | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/common/src/volumes/chunk.rs b/common/src/volumes/chunk.rs index e395a762ef..6485b2248e 100644 --- a/common/src/volumes/chunk.rs +++ b/common/src/volumes/chunk.rs @@ -32,10 +32,7 @@ impl Chunk { 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 } diff --git a/common/src/volumes/dyna.rs b/common/src/volumes/dyna.rs index 51d6d111d8..ffec84f273 100644 --- a/common/src/volumes/dyna.rs +++ b/common/src/volumes/dyna.rs @@ -27,7 +27,7 @@ impl Dyna { #[inline(always)] fn idx_for(sz: Vec3, pos: Vec3) -> Option { 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 }