Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
4c20d8c0
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看板
提交
4c20d8c0
编写于
5月 10, 2010
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Sprinkle a few strategic likely()'s
Shrinks the code size by some 2% even.
上级
69cb28bc
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
12 deletion
+12
-12
src/hb-open-file-private.hh
src/hb-open-file-private.hh
+2
-2
src/hb-open-type-private.hh
src/hb-open-type-private.hh
+10
-10
未找到文件。
src/hb-open-file-private.hh
浏览文件 @
4c20d8c0
...
...
@@ -168,7 +168,7 @@ struct TTCHeader
inline
bool
sanitize
(
hb_sanitize_context_t
*
context
)
{
TRACE_SANITIZE
();
if
(
!
u
.
header
.
version
.
sanitize
(
context
))
return
false
;
if
(
unlikely
(
!
u
.
header
.
version
.
sanitize
(
context
)
))
return
false
;
switch
(
u
.
header
.
version
)
{
case
2
:
/* version 2 is compatible with version 1 */
case
1
:
return
u
.
version1
.
sanitize
(
context
);
...
...
@@ -230,7 +230,7 @@ struct OpenTypeFontFile
inline
bool
sanitize
(
hb_sanitize_context_t
*
context
)
{
TRACE_SANITIZE
();
if
(
!
u
.
tag
.
sanitize
(
context
))
return
false
;
if
(
unlikely
(
!
u
.
tag
.
sanitize
(
context
)
))
return
false
;
switch
(
u
.
tag
)
{
case
CFFTag
:
/* All the non-collection tags */
case
TrueTag
:
...
...
src/hb-open-type-private.hh
浏览文件 @
4c20d8c0
...
...
@@ -386,7 +386,7 @@ struct IntType
inline
bool
operator
!=
(
const
IntType
<
Type
>
&
o
)
const
{
return
v
!=
o
.
v
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
context
)
{
TRACE_SANITIZE
();
return
context
->
check_struct
(
this
);
return
likely
(
context
->
check_struct
(
this
)
);
}
protected:
BEInt
<
Type
,
sizeof
(
Type
)
>
v
;
...
...
@@ -482,7 +482,7 @@ struct GenericOffsetTo : OffsetType
inline
bool
sanitize
(
hb_sanitize_context_t
*
context
,
void
*
base
)
{
TRACE_SANITIZE
();
if
(
!
context
->
check_struct
(
this
))
return
false
;
if
(
unlikely
(
!
context
->
check_struct
(
this
)
))
return
false
;
unsigned
int
offset
=
*
this
;
if
(
unlikely
(
!
offset
))
return
true
;
Type
&
obj
=
StructAtOffset
<
Type
>
(
base
,
offset
);
...
...
@@ -491,7 +491,7 @@ struct GenericOffsetTo : OffsetType
template
<
typename
T
>
inline
bool
sanitize
(
hb_sanitize_context_t
*
context
,
void
*
base
,
T
user_data
)
{
TRACE_SANITIZE
();
if
(
!
context
->
check_struct
(
this
))
return
false
;
if
(
unlikely
(
!
context
->
check_struct
(
this
)
))
return
false
;
unsigned
int
offset
=
*
this
;
if
(
unlikely
(
!
offset
))
return
true
;
Type
&
obj
=
StructAtOffset
<
Type
>
(
base
,
offset
);
...
...
@@ -547,7 +547,7 @@ struct GenericArrayOf
inline
bool
sanitize
(
hb_sanitize_context_t
*
context
)
{
TRACE_SANITIZE
();
if
(
!
likely
(
sanitize_shallow
(
context
)))
return
false
;
if
(
unlikely
(
!
sanitize_shallow
(
context
)))
return
false
;
/* Note: for structs that do not reference other structs,
* we do not need to call their sanitize() as we already did
* a bound check on the aggregate array size, hence the return.
...
...
@@ -564,20 +564,20 @@ struct GenericArrayOf
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
context
,
void
*
base
)
{
TRACE_SANITIZE
();
if
(
!
likely
(
sanitize_shallow
(
context
)))
return
false
;
if
(
unlikely
(
!
sanitize_shallow
(
context
)))
return
false
;
unsigned
int
count
=
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
!
array
[
i
].
sanitize
(
context
,
base
))
if
(
unlikely
(
!
array
[
i
].
sanitize
(
context
,
base
)
))
return
false
;
return
true
;
}
template
<
typename
T
>
inline
bool
sanitize
(
hb_sanitize_context_t
*
context
,
void
*
base
,
T
user_data
)
{
TRACE_SANITIZE
();
if
(
!
likely
(
sanitize_shallow
(
context
)))
return
false
;
if
(
unlikely
(
!
sanitize_shallow
(
context
)))
return
false
;
unsigned
int
count
=
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
!
array
[
i
].
sanitize
(
context
,
base
,
user_data
))
if
(
unlikely
(
!
array
[
i
].
sanitize
(
context
,
base
,
user_data
)
))
return
false
;
return
true
;
}
...
...
@@ -658,7 +658,7 @@ struct HeadlessArrayOf
inline
bool
sanitize
(
hb_sanitize_context_t
*
context
)
{
TRACE_SANITIZE
();
if
(
!
likely
(
sanitize_shallow
(
context
)))
return
false
;
if
(
unlikely
(
!
sanitize_shallow
(
context
)))
return
false
;
/* Note: for structs that do not reference other structs,
* we do not need to call their sanitize() as we already did
* a bound check on the aggregate array size, hence the return.
...
...
@@ -670,7 +670,7 @@ struct HeadlessArrayOf
unsigned
int
count
=
len
?
len
-
1
:
0
;
Type
*
a
=
array
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
!
a
[
i
].
sanitize
(
context
))
if
(
unlikely
(
!
a
[
i
].
sanitize
(
context
)
))
return
false
;
return
true
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录