aboutsummaryrefslogtreecommitdiff
path: root/azalea-core/src/position.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2023-10-05 01:40:25 -0500
committermat <git@matdoes.dev>2023-10-05 01:40:25 -0500
commit177864be60c08cb61fd577eb99ee5c99481fc03e (patch)
tree982fbe6430b1818fec7134e26378fd5f626a1ed4 /azalea-core/src/position.rs
parente4e0433853d1e2d9d95d4269700df032db9dd913 (diff)
downloadazalea-drasl-177864be60c08cb61fd577eb99ee5c99481fc03e.tar.xz
replace a linear search with a binary search . . .
Diffstat (limited to 'azalea-core/src/position.rs')
-rwxr-xr-xazalea-core/src/position.rs8
1 files changed, 4 insertions, 4 deletions
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<BlockPos> 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,
}
}
}