Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
1ce7d6e2
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看板
提交
1ce7d6e2
编写于
12月 16, 2017
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[set] Optimize add_array() / add_sorted_array()
Does page lookup as needed.
上级
71e6adf1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
38 addition
and
16 deletion
+38
-16
src/hb-set-private.hh
src/hb-set-private.hh
+38
-16
未找到文件。
src/hb-set-private.hh
浏览文件 @
1ce7d6e2
...
...
@@ -225,8 +225,7 @@ struct hb_set_t
{
if
(
unlikely
(
in_error
))
return
;
if
(
unlikely
(
g
==
INVALID
))
return
;
page_t
*
page
=
page_for_insert
(
g
);
if
(
unlikely
(
!
page
))
return
;
page_t
*
page
=
page_for_insert
(
g
);
if
(
unlikely
(
!
page
))
return
;
page
->
add
(
g
);
}
inline
bool
add_range
(
hb_codepoint_t
a
,
hb_codepoint_t
b
)
...
...
@@ -236,25 +235,21 @@ struct hb_set_t
unsigned
int
mb
=
get_major
(
b
);
if
(
ma
==
mb
)
{
page_t
*
page
=
page_for_insert
(
a
);
if
(
unlikely
(
!
page
))
return
false
;
page_t
*
page
=
page_for_insert
(
a
);
if
(
unlikely
(
!
page
))
return
false
;
page
->
add_range
(
a
,
b
);
}
else
{
page_t
*
page
=
page_for_insert
(
a
);
if
(
unlikely
(
!
page
))
return
false
;
page_t
*
page
=
page_for_insert
(
a
);
if
(
unlikely
(
!
page
))
return
false
;
page
->
add_range
(
a
,
major_start
(
ma
+
1
)
-
1
);
for
(
unsigned
int
m
=
ma
+
1
;
m
<
mb
;
m
++
)
{
page
=
page_for_insert
(
major_start
(
m
));
if
(
unlikely
(
!
page
))
return
false
;
page
=
page_for_insert
(
major_start
(
m
));
if
(
unlikely
(
!
page
))
return
false
;
page
->
init1
();
}
page
=
page_for_insert
(
b
);
if
(
unlikely
(
!
page
))
return
false
;
page
=
page_for_insert
(
b
);
if
(
unlikely
(
!
page
))
return
false
;
page
->
add_range
(
major_start
(
mb
),
b
);
}
return
true
;
...
...
@@ -263,21 +258,48 @@ struct hb_set_t
template
<
typename
T
>
inline
void
add_array
(
const
T
*
array
,
unsigned
int
count
,
unsigned
int
stride
=
sizeof
(
T
))
{
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
unlikely
(
in_error
))
return
;
if
(
!
count
)
return
;
hb_codepoint_t
g
=
*
array
;
while
(
count
)
{
add
(
*
array
);
array
=
(
const
T
*
)
(
stride
+
(
const
char
*
)
array
);
unsigned
int
m
=
get_major
(
g
);
page_t
*
page
=
page_for_insert
(
g
);
if
(
unlikely
(
!
page
))
return
;
unsigned
int
start
=
major_start
(
m
);
unsigned
int
end
=
major_start
(
m
+
1
);
do
{
page
->
add
(
g
);
array
++
;
count
--
;
}
while
(
count
&&
(
g
=
*
array
,
start
<=
g
&&
g
<
end
));
}
}
/* Might return false if array looks unsorted.
* Used for faster rejection of corrupt data. */
template
<
typename
T
>
inline
bool
add_sorted_array
(
const
T
*
array
,
unsigned
int
count
,
unsigned
int
stride
=
sizeof
(
T
))
{
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
unlikely
(
in_error
))
return
true
;
//XXXfalse
if
(
!
count
)
return
true
;
hb_codepoint_t
g
=
*
array
;
while
(
count
)
{
add
(
*
array
);
array
=
(
const
T
*
)
(
stride
+
(
const
char
*
)
array
);
unsigned
int
m
=
get_major
(
g
);
page_t
*
page
=
page_for_insert
(
g
);
if
(
unlikely
(
!
page
))
return
false
;
unsigned
int
start
=
major_start
(
m
);
unsigned
int
end
=
major_start
(
m
+
1
);
do
{
page
->
add
(
g
);
array
++
;
count
--
;
}
while
(
count
&&
(
g
=
*
array
,
start
<=
g
&&
g
<
end
));
}
return
true
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录