From 70a3683df2a11fb03319078c27c7b0bb72f061d1 Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Fri, 25 Sep 2015 15:20:55 +0100 Subject: [PATCH] Clean up --- protocol/src/types/bit/map.rs | 10 +++++++++- protocol/src/types/blockpos.rs | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/protocol/src/types/bit/map.rs b/protocol/src/types/bit/map.rs index 8d289c0..b1b9e05 100644 --- a/protocol/src/types/bit/map.rs +++ b/protocol/src/types/bit/map.rs @@ -60,6 +60,14 @@ impl Map { map } + pub fn resize(self, size: usize) -> Map { + let mut n = Map::new(self.length, size); + for i in 0 .. self.length { + n.set(i, self.get(i)); + } + n + } + pub fn set(&mut self, i: usize, val: usize) { let i = i * self.bit_size; let pos = i / 64; @@ -74,7 +82,7 @@ impl Map { } } - pub fn get(&mut self, i: usize) -> usize { + pub fn get(&self, i: usize) -> usize { let i = i * self.bit_size; let pos = i / 64; let mask = (1 << self.bit_size) - 1; diff --git a/protocol/src/types/blockpos.rs b/protocol/src/types/blockpos.rs index 7e36c55..cc38604 100644 --- a/protocol/src/types/blockpos.rs +++ b/protocol/src/types/blockpos.rs @@ -24,6 +24,7 @@ use self::byteorder::{BigEndian, WriteBytesExt, ReadBytesExt}; pub struct Position(u64); impl Position { + #[allow(dead_code)] fn new(x: i32, y: i32, z: i32) -> Position { Position( (((x as u64) & 0x3FFFFFF) << 38) |