This commit is contained in:
Thinkofdeath 2015-09-25 15:20:55 +01:00
parent 12847e9686
commit 70a3683df2
2 changed files with 10 additions and 1 deletions

View File

@ -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;

View File

@ -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) |