From 177864be60c08cb61fd577eb99ee5c99481fc03e Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 5 Oct 2023 01:40:25 -0500 Subject: replace a linear search with a binary search . . . --- azalea-core/src/position.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'azalea-core/src') diff --git a/azalea-core/src/position.rs b/azalea-core/src/position.rs index f6bc4157..540419ba 100755 --- a/azalea-core/src/position.rs +++ b/azalea-core/src/position.rs @@ -246,7 +246,7 @@ impl Hash for ChunkPos { impl nohash_hasher::IsEnabled for ChunkPos {} /// The coordinates of a chunk section in the world. -#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)] pub struct ChunkSectionPos { pub x: i32, pub y: i32, @@ -413,9 +413,9 @@ impl From for ChunkSectionBlockPos { #[inline] fn from(pos: BlockPos) -> Self { ChunkSectionBlockPos { - x: pos.x as u8 & 0xF, - y: pos.y as u8 & 0xF, - z: pos.z as u8 & 0xF, + x: (pos.x & 0xF) as u8, + y: (pos.y & 0xF) as u8, + z: (pos.z & 0xF) as u8, } } } -- cgit v1.2.3