Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
686476a8
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
接近 2 年 前同步成功
通知
1
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看板
提交
686476a8
编写于
5月 29, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[map] Track population and occupancy separately
上级
8a978790
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
22 addition
and
9 deletion
+22
-9
src/hb-map-private.hh
src/hb-map-private.hh
+21
-9
src/hb-map.cc
src/hb-map.cc
+1
-0
未找到文件。
src/hb-map-private.hh
浏览文件 @
686476a8
...
...
@@ -57,6 +57,7 @@ struct hb_map_t
hb_object_header_t
header
;
ASSERT_POD
();
bool
in_error
;
unsigned
int
population
;
/* Not including tombstones. */
unsigned
int
occupancy
;
/* Including tombstones. */
unsigned
int
mask
;
unsigned
int
prime
;
...
...
@@ -65,6 +66,7 @@ struct hb_map_t
inline
void
init_shallow
(
void
)
{
in_error
=
false
;
population
=
0
;
occupancy
=
0
;
mask
=
0
;
prime
=
0
;
...
...
@@ -89,7 +91,7 @@ struct hb_map_t
{
if
(
unlikely
(
in_error
))
return
false
;
unsigned
int
power
=
_hb_bit_storage
(
occupancy
*
2
+
8
)
-
1
;
unsigned
int
power
=
_hb_bit_storage
(
population
*
2
+
8
)
-
1
;
unsigned
int
new_size
=
1u
<<
power
;
item_t
*
new_items
=
(
item_t
*
)
malloc
((
size_t
)
new_size
*
sizeof
(
item_t
));
if
(
unlikely
(
!
new_items
))
...
...
@@ -103,6 +105,7 @@ struct hb_map_t
item_t
*
old_items
=
items
;
/* Switch to new, empty, array. */
population
=
0
;
occupancy
=
0
;
mask
=
new_size
-
1
;
prime
=
prime_for
(
power
);
...
...
@@ -121,14 +124,26 @@ struct hb_map_t
inline
void
set
(
hb_codepoint_t
key
,
hb_codepoint_t
value
)
{
if
(
unlikely
(
in_error
))
return
;
if
(
unlikely
(
key
==
INVALID
))
return
;
if
((
occupancy
+
occupancy
/
2
)
>
mask
&&
!
resize
())
return
;
unsigned
int
i
=
bucket_for
(
key
);
if
(
items
[
i
].
key
!=
key
)
if
(
value
==
INVALID
&&
items
[
i
].
key
!=
key
)
return
;
/* Trying to delete non-existent key. */
/* Accounting. */
if
(
items
[
i
].
is_tombstone
())
occupancy
--
;
else
if
(
!
items
[
i
].
is_unused
())
{
if
(
items
[
i
].
key
==
INVALID
&&
key
!=
INVALID
)
occupancy
++
;
items
[
i
].
key
=
key
;
population
--
;
occupancy
--
;
}
occupancy
++
;
if
(
value
!=
INVALID
)
population
++
;
items
[
i
].
key
=
key
;
items
[
i
].
value
=
value
;
}
inline
hb_codepoint_t
get
(
hb_codepoint_t
key
)
const
...
...
@@ -141,10 +156,7 @@ struct hb_map_t
inline
void
del
(
hb_codepoint_t
key
)
{
if
(
unlikely
(
in_error
))
return
;
if
(
unlikely
(
!
items
))
return
;
unsigned
int
i
=
bucket_for
(
key
);
items
[
i
].
value
=
INVALID
;
set
(
key
,
INVALID
);
}
inline
bool
has
(
hb_codepoint_t
key
)
const
{
...
...
src/hb-map.cc
浏览文件 @
686476a8
...
...
@@ -53,6 +53,7 @@ hb_map_create (void)
static
const
hb_map_t
_hb_map_nil
=
{
HB_OBJECT_HEADER_STATIC
,
true
,
/* in_error */
0
,
/* population */
0
,
/* occupancy */
0
,
/* mask */
0
,
/* prime */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录