Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
4f76f956
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
大约 1 年 前同步成功
通知
0
Star
18
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Harfbuzz
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4f76f956
编写于
6月 01, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[map] Move prime_for to hb-static
上级
33d6f46b
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
54 addition
and
52 deletion
+54
-52
src/hb-map-private.hh
src/hb-map-private.hh
+1
-52
src/hb-private.hh
src/hb-private.hh
+2
-0
src/hb-static.cc
src/hb-static.cc
+51
-0
未找到文件。
src/hb-map-private.hh
浏览文件 @
4f76f956
...
@@ -39,49 +39,6 @@ inline uint32_t Hash (const T &v)
...
@@ -39,49 +39,6 @@ inline uint32_t Hash (const T &v)
}
}
/* Following comment and table copied from glib. */
/* Each table size has an associated prime modulo (the first prime
* lower than the table size) used to find the initial bucket. Probing
* then works modulo 2^n. The prime modulo is necessary to get a
* good distribution with poor hash functions.
*/
static
const
unsigned
int
prime_mod
[]
=
{
1
,
/* For 1 << 0 */
2
,
3
,
7
,
13
,
31
,
61
,
127
,
251
,
509
,
1021
,
2039
,
4093
,
8191
,
16381
,
32749
,
65521
,
/* For 1 << 16 */
131071
,
262139
,
524287
,
1048573
,
2097143
,
4194301
,
8388593
,
16777213
,
33554393
,
67108859
,
134217689
,
268435399
,
536870909
,
1073741789
,
2147483647
/* For 1 << 31 */
};
/*
/*
* hb_map_t
* hb_map_t
*/
*/
...
@@ -148,7 +105,7 @@ struct hb_map_t
...
@@ -148,7 +105,7 @@ struct hb_map_t
/* Switch to new, empty, array. */
/* Switch to new, empty, array. */
population
=
occupancy
=
0
;
population
=
occupancy
=
0
;
mask
=
new_size
-
1
;
mask
=
new_size
-
1
;
prime
=
prime_for
(
power
);
prime
=
_hb_
prime_for
(
power
);
items
=
new_items
;
items
=
new_items
;
/* Insert back old items. */
/* Insert back old items. */
...
@@ -226,14 +183,6 @@ struct hb_map_t
...
@@ -226,14 +183,6 @@ struct hb_map_t
protected:
protected:
static
inline
unsigned
int
prime_for
(
unsigned
int
shift
)
{
if
(
unlikely
(
shift
>=
ARRAY_LENGTH
(
prime_mod
)))
return
prime_mod
[
ARRAY_LENGTH
(
prime_mod
)
-
1
];
return
prime_mod
[
shift
];
}
inline
unsigned
int
bucket_for
(
hb_codepoint_t
key
)
const
inline
unsigned
int
bucket_for
(
hb_codepoint_t
key
)
const
{
{
unsigned
int
i
=
Hash
(
key
)
%
prime
;
unsigned
int
i
=
Hash
(
key
)
%
prime
;
...
...
src/hb-private.hh
浏览文件 @
4f76f956
...
@@ -1231,5 +1231,7 @@ round (double x)
...
@@ -1231,5 +1231,7 @@ round (double x)
#endif
#endif
HB_INTERNAL
unsigned
int
_hb_prime_for
(
unsigned
int
shift
);
#endif
/* HB_PRIVATE_HH */
#endif
/* HB_PRIVATE_HH */
src/hb-static.cc
浏览文件 @
4f76f956
...
@@ -30,3 +30,54 @@
...
@@ -30,3 +30,54 @@
void
*
const
_hb_NullPool
[
HB_NULL_POOL_SIZE
/
sizeof
(
void
*
)]
=
{};
void
*
const
_hb_NullPool
[
HB_NULL_POOL_SIZE
/
sizeof
(
void
*
)]
=
{};
/*thread_local*/
void
*
_hb_CrapPool
[
HB_NULL_POOL_SIZE
/
sizeof
(
void
*
)]
=
{};
/*thread_local*/
void
*
_hb_CrapPool
[
HB_NULL_POOL_SIZE
/
sizeof
(
void
*
)]
=
{};
#endif
#endif
/* Following comment and table copied from glib. */
/* Each table size has an associated prime modulo (the first prime
* lower than the table size) used to find the initial bucket. Probing
* then works modulo 2^n. The prime modulo is necessary to get a
* good distribution with poor hash functions.
*/
static
const
unsigned
int
prime_mod
[]
=
{
1
,
/* For 1 << 0 */
2
,
3
,
7
,
13
,
31
,
61
,
127
,
251
,
509
,
1021
,
2039
,
4093
,
8191
,
16381
,
32749
,
65521
,
/* For 1 << 16 */
131071
,
262139
,
524287
,
1048573
,
2097143
,
4194301
,
8388593
,
16777213
,
33554393
,
67108859
,
134217689
,
268435399
,
536870909
,
1073741789
,
2147483647
/* For 1 << 31 */
};
unsigned
int
_hb_prime_for
(
unsigned
int
shift
)
{
if
(
unlikely
(
shift
>=
ARRAY_LENGTH
(
prime_mod
)))
return
prime_mod
[
ARRAY_LENGTH
(
prime_mod
)
-
1
];
return
prime_mod
[
shift
];
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录