mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Upgrade rustc to d3c49d2140fc65e8bb7d7cf25bfe74dda6ce5ecf/rustc-1.0.0-dev.
This commit is contained in:
parent
65d4b12bf2
commit
5f15eb5fbf
140 changed files with 1420 additions and 1222 deletions
|
@ -5,7 +5,8 @@
|
|||
//! This file stolen wholesale from rustc/src/librustc/util/nodemap.rs
|
||||
|
||||
use std::default::Default;
|
||||
use std::hash::{Hasher, Writer};
|
||||
use std::hash::Hasher;
|
||||
use std::num::wrapping::WrappingOps;
|
||||
|
||||
/// A speedy hash algorithm for node ids and def ids. The hashmap in
|
||||
/// libcollections by default uses SipHash which isn't quite as speedy as we
|
||||
|
@ -22,17 +23,12 @@ impl Default for FnvHasher {
|
|||
}
|
||||
|
||||
impl Hasher for FnvHasher {
|
||||
type Output = u64;
|
||||
fn reset(&mut self) { *self = Default::default(); }
|
||||
fn finish(&self) -> u64 { self.0 }
|
||||
}
|
||||
|
||||
impl Writer for FnvHasher {
|
||||
fn write(&mut self, bytes: &[u8]) {
|
||||
let FnvHasher(mut hash) = *self;
|
||||
for byte in bytes.iter() {
|
||||
hash = hash ^ (*byte as u64);
|
||||
hash = hash * 0x100000001b3;
|
||||
hash = hash.wrapping_mul(0x100000001b3);
|
||||
}
|
||||
*self = FnvHasher(hash);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue