Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
daa76446
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
daa76446
编写于
8月 02, 2017
作者:
M
Matt Brubeck
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove unused fnv hash code
上级
cd87b5d5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
0 addition
and
67 deletion
+0
-67
src/librustc_data_structures/fnv.rs
src/librustc_data_structures/fnv.rs
+0
-66
src/librustc_data_structures/lib.rs
src/librustc_data_structures/lib.rs
+0
-1
未找到文件。
src/librustc_data_structures/fnv.rs
已删除
100644 → 0
浏览文件 @
cd87b5d5
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use
std
::
collections
::{
HashMap
,
HashSet
};
use
std
::
default
::
Default
;
use
std
::
hash
::{
Hasher
,
Hash
,
BuildHasherDefault
};
pub
type
FnvHashMap
<
K
,
V
>
=
HashMap
<
K
,
V
,
BuildHasherDefault
<
FnvHasher
>>
;
pub
type
FnvHashSet
<
V
>
=
HashSet
<
V
,
BuildHasherDefault
<
FnvHasher
>>
;
#[allow(non_snake_case)]
pub
fn
FnvHashMap
<
K
:
Hash
+
Eq
,
V
>
()
->
FnvHashMap
<
K
,
V
>
{
HashMap
::
default
()
}
#[allow(non_snake_case)]
pub
fn
FnvHashSet
<
V
:
Hash
+
Eq
>
()
->
FnvHashSet
<
V
>
{
HashSet
::
default
()
}
/// A speedy hash algorithm for node ids and def ids. The hashmap in
/// liballoc by default uses SipHash which isn't quite as speedy as we
/// want. In the compiler we're not really worried about DOS attempts, so we
/// just default to a non-cryptographic hash.
///
/// This uses FNV hashing, as described here:
/// http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
pub
struct
FnvHasher
(
u64
);
impl
Default
for
FnvHasher
{
/// Creates a `FnvHasher`, with a 64-bit hex initial value.
#[inline]
fn
default
()
->
FnvHasher
{
FnvHasher
(
0xcbf29ce484222325
)
}
}
impl
Hasher
for
FnvHasher
{
#[inline]
fn
write
(
&
mut
self
,
bytes
:
&
[
u8
])
{
let
FnvHasher
(
mut
hash
)
=
*
self
;
for
byte
in
bytes
{
hash
=
hash
^
(
*
byte
as
u64
);
hash
=
hash
.wrapping_mul
(
0x100000001b3
);
}
*
self
=
FnvHasher
(
hash
);
}
#[inline]
fn
finish
(
&
self
)
->
u64
{
self
.0
}
}
pub
fn
hash
<
T
:
Hash
>
(
v
:
&
T
)
->
u64
{
let
mut
state
=
FnvHasher
::
default
();
v
.hash
(
&
mut
state
);
state
.finish
()
}
src/librustc_data_structures/lib.rs
浏览文件 @
daa76446
...
@@ -65,7 +65,6 @@
...
@@ -65,7 +65,6 @@
pub
mod
stable_hasher
;
pub
mod
stable_hasher
;
pub
mod
transitive_relation
;
pub
mod
transitive_relation
;
pub
mod
unify
;
pub
mod
unify
;
pub
mod
fnv
;
pub
mod
fx
;
pub
mod
fx
;
pub
mod
tuple_slice
;
pub
mod
tuple_slice
;
pub
mod
veccell
;
pub
mod
veccell
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录