From 81d426f7a093e7a04788e8b218dd83dae30b0c06 Mon Sep 17 00:00:00 2001 From: Imbris Date: Fri, 8 Oct 2021 10:56:02 -0400 Subject: [PATCH] Try marking Chonk::for_each_in and related functions as inlineable --- common/src/terrain/chonk.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/src/terrain/chonk.rs b/common/src/terrain/chonk.rs index 3ec18617e7..94f3a3f501 100644 --- a/common/src/terrain/chonk.rs +++ b/common/src/terrain/chonk.rs @@ -57,8 +57,10 @@ impl Chonk { pub fn meta(&self) -> &M { &self.meta } + #[inline] pub fn get_min_z(&self) -> i32 { self.z_offset } + #[inline] pub fn get_max_z(&self) -> i32 { self.z_offset + (self.sub_chunks.len() as u32 * SubChunkSize::::SIZE.z) as i32 } @@ -71,6 +73,7 @@ impl Chonk { // Returns the index (in self.sub_chunks) of the SubChunk that contains // layer z; note that this index changes when more SubChunks are prepended + #[inline] fn sub_chunk_idx(&self, z: i32) -> i32 { let diff = z - self.z_offset; diff >> (SubChunkSize::::SIZE.z - 1).count_ones() @@ -166,7 +169,7 @@ impl ReadVol for Chonk { /// Call provided closure with each block in the supplied Aabb /// Portions of the Aabb outside this chonk are ignored - //#[inline] + #[inline] fn for_each_in(&self, aabb: Aabb, mut f: impl FnMut(Vec3, V)) where V: Copy,