Initial block model support
This commit is contained in:
parent
a42c1e412a
commit
ce6f5c963c
|
@ -17,7 +17,7 @@ extern crate byteorder;
|
|||
use std::fmt;
|
||||
use protocol::Serializable;
|
||||
use std::io;
|
||||
use std::io::{Read, Write};
|
||||
use std::io::Write;
|
||||
use self::byteorder::{BigEndian, WriteBytesExt, ReadBytesExt};
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
|
||||
use std::hash::Hasher;
|
||||
|
||||
pub struct FNVHash(u64);
|
||||
|
||||
impl Hasher for FNVHash {
|
||||
fn write(&mut self, bytes: &[u8]) {
|
||||
for b in bytes {
|
||||
self.0 = self.0.wrapping_mul(0x100000001b3);
|
||||
self.0 ^= *b as u64
|
||||
}
|
||||
}
|
||||
|
||||
fn finish(&self) -> u64 {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for FNVHash {
|
||||
fn default() -> Self {
|
||||
FNVHash(0xcbf29ce484222325)
|
||||
}
|
||||
}
|
|
@ -20,3 +20,4 @@ pub use self::metadata::*;
|
|||
|
||||
pub mod bit;
|
||||
pub mod nibble;
|
||||
pub mod hash;
|
||||
|
|
Loading…
Reference in New Issue