Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
2e48fd07
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看板
提交
2e48fd07
编写于
7月 02, 2019
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Sprinkle constexpr around
Being conservative. Also not sure it makes any real difference in our codebase.
上级
df444806
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
33 addition
and
33 deletion
+33
-33
src/hb-algs.hh
src/hb-algs.hh
+24
-24
src/hb-meta.hh
src/hb-meta.hh
+9
-9
未找到文件。
src/hb-algs.hh
浏览文件 @
2e48fd07
...
...
@@ -50,31 +50,31 @@
struct
{
/* Note. This is dangerous in that if it's passed an rvalue, it returns rvalue-reference. */
template
<
typename
T
>
auto
template
<
typename
T
>
constexpr
auto
operator
()
(
T
&&
v
)
const
HB_AUTO_RETURN
(
hb_forward
<
T
>
(
v
)
)
}
HB_FUNCOBJ
(
hb_identity
);
struct
{
/* Like identity(), but only retains lvalue-references. Rvalues are returned as rvalues. */
template
<
typename
T
>
T
&
template
<
typename
T
>
constexpr
T
&
operator
()
(
T
&
v
)
const
{
return
v
;
}
template
<
typename
T
>
hb_remove_reference
<
T
>
template
<
typename
T
>
constexpr
hb_remove_reference
<
T
>
operator
()
(
T
&&
v
)
const
{
return
v
;
}
}
HB_FUNCOBJ
(
hb_lidentity
);
struct
{
/* Like identity(), but always returns rvalue. */
template
<
typename
T
>
hb_remove_reference
<
T
>
template
<
typename
T
>
constexpr
hb_remove_reference
<
T
>
operator
()
(
T
&&
v
)
const
{
return
v
;
}
}
HB_FUNCOBJ
(
hb_ridentity
);
struct
{
template
<
typename
T
>
bool
template
<
typename
T
>
constexpr
bool
operator
()
(
T
&&
v
)
const
{
return
bool
(
hb_forward
<
T
>
(
v
));
}
}
HB_FUNCOBJ
(
hb_bool
);
...
...
@@ -82,11 +82,11 @@ HB_FUNCOBJ (hb_bool);
struct
{
private:
template
<
typename
T
>
auto
template
<
typename
T
>
constexpr
auto
impl
(
const
T
&
v
,
hb_priority
<
1
>
)
const
HB_RETURN
(
uint32_t
,
hb_deref
(
v
).
hash
())
template
<
typename
T
,
hb_enable_if
(
hb_is_integral
(
T
))>
auto
hb_enable_if
(
hb_is_integral
(
T
))>
constexpr
auto
impl
(
const
T
&
v
,
hb_priority
<
0
>
)
const
HB_AUTO_RETURN
(
/* Knuth's multiplicative method: */
...
...
@@ -95,7 +95,7 @@ struct
public:
template
<
typename
T
>
auto
template
<
typename
T
>
constexpr
auto
operator
()
(
const
T
&
v
)
const
HB_RETURN
(
uint32_t
,
impl
(
v
,
hb_prioritize
))
}
HB_FUNCOBJ
(
hb_hash
);
...
...
@@ -328,14 +328,14 @@ hb_pair (T1&& a, T2&& b) { return hb_pair_t<T1, T2> (a, b); }
struct
{
template
<
typename
Pair
>
typename
Pair
::
first_t
template
<
typename
Pair
>
constexpr
typename
Pair
::
first_t
operator
()
(
const
Pair
&
pair
)
const
{
return
pair
.
first
;
}
}
HB_FUNCOBJ
(
hb_first
);
struct
{
template
<
typename
Pair
>
typename
Pair
::
second_t
template
<
typename
Pair
>
constexpr
typename
Pair
::
second_t
operator
()
(
const
Pair
&
pair
)
const
{
return
pair
.
second
;
}
}
HB_FUNCOBJ
(
hb_second
);
...
...
@@ -346,14 +346,14 @@ HB_FUNCOBJ (hb_second);
* comparing integers of different signedness. */
struct
{
template
<
typename
T
,
typename
T2
>
auto
template
<
typename
T
,
typename
T2
>
constexpr
auto
operator
()
(
T
&&
a
,
T2
&&
b
)
const
HB_AUTO_RETURN
(
hb_forward
<
T
>
(
a
)
<=
hb_forward
<
T2
>
(
b
)
?
hb_forward
<
T
>
(
a
)
:
hb_forward
<
T2
>
(
b
))
}
HB_FUNCOBJ
(
hb_min
);
struct
{
template
<
typename
T
,
typename
T2
>
auto
template
<
typename
T
,
typename
T2
>
constexpr
auto
operator
()
(
T
&&
a
,
T2
&&
b
)
const
HB_AUTO_RETURN
(
hb_forward
<
T
>
(
a
)
>=
hb_forward
<
T2
>
(
b
)
?
hb_forward
<
T
>
(
a
)
:
hb_forward
<
T2
>
(
b
))
}
...
...
@@ -917,7 +917,7 @@ struct hb_bitwise_and
{
HB_PARTIALIZE
(
2
);
static
constexpr
bool
passthru_left
=
false
;
static
constexpr
bool
passthru_right
=
false
;
template
<
typename
T
>
auto
template
<
typename
T
>
constexpr
auto
operator
()
(
const
T
&
a
,
const
T
&
b
)
const
HB_AUTO_RETURN
(
a
&
b
)
}
HB_FUNCOBJ
(
hb_bitwise_and
);
...
...
@@ -925,7 +925,7 @@ struct hb_bitwise_or
{
HB_PARTIALIZE
(
2
);
static
constexpr
bool
passthru_left
=
true
;
static
constexpr
bool
passthru_right
=
true
;
template
<
typename
T
>
auto
template
<
typename
T
>
constexpr
auto
operator
()
(
const
T
&
a
,
const
T
&
b
)
const
HB_AUTO_RETURN
(
a
|
b
)
}
HB_FUNCOBJ
(
hb_bitwise_or
);
...
...
@@ -933,7 +933,7 @@ struct hb_bitwise_xor
{
HB_PARTIALIZE
(
2
);
static
constexpr
bool
passthru_left
=
true
;
static
constexpr
bool
passthru_right
=
true
;
template
<
typename
T
>
auto
template
<
typename
T
>
constexpr
auto
operator
()
(
const
T
&
a
,
const
T
&
b
)
const
HB_AUTO_RETURN
(
a
^
b
)
}
HB_FUNCOBJ
(
hb_bitwise_xor
);
...
...
@@ -941,56 +941,56 @@ struct hb_bitwise_sub
{
HB_PARTIALIZE
(
2
);
static
constexpr
bool
passthru_left
=
true
;
static
constexpr
bool
passthru_right
=
false
;
template
<
typename
T
>
auto
template
<
typename
T
>
constexpr
auto
operator
()
(
const
T
&
a
,
const
T
&
b
)
const
HB_AUTO_RETURN
(
a
&
~
b
)
}
HB_FUNCOBJ
(
hb_bitwise_sub
);
struct
{
template
<
typename
T
>
auto
template
<
typename
T
>
constexpr
auto
operator
()
(
const
T
&
a
)
const
HB_AUTO_RETURN
(
~
a
)
}
HB_FUNCOBJ
(
hb_bitwise_neg
);
struct
{
HB_PARTIALIZE
(
2
);
template
<
typename
T
,
typename
T2
>
auto
template
<
typename
T
,
typename
T2
>
constexpr
auto
operator
()
(
const
T
&
a
,
const
T2
&
b
)
const
HB_AUTO_RETURN
(
a
+
b
)
}
HB_FUNCOBJ
(
hb_add
);
struct
{
HB_PARTIALIZE
(
2
);
template
<
typename
T
,
typename
T2
>
auto
template
<
typename
T
,
typename
T2
>
constexpr
auto
operator
()
(
const
T
&
a
,
const
T2
&
b
)
const
HB_AUTO_RETURN
(
a
-
b
)
}
HB_FUNCOBJ
(
hb_sub
);
struct
{
HB_PARTIALIZE
(
2
);
template
<
typename
T
,
typename
T2
>
auto
template
<
typename
T
,
typename
T2
>
constexpr
auto
operator
()
(
const
T
&
a
,
const
T2
&
b
)
const
HB_AUTO_RETURN
(
a
*
b
)
}
HB_FUNCOBJ
(
hb_mul
);
struct
{
HB_PARTIALIZE
(
2
);
template
<
typename
T
,
typename
T2
>
auto
template
<
typename
T
,
typename
T2
>
constexpr
auto
operator
()
(
const
T
&
a
,
const
T2
&
b
)
const
HB_AUTO_RETURN
(
a
/
b
)
}
HB_FUNCOBJ
(
hb_div
);
struct
{
HB_PARTIALIZE
(
2
);
template
<
typename
T
,
typename
T2
>
auto
template
<
typename
T
,
typename
T2
>
constexpr
auto
operator
()
(
const
T
&
a
,
const
T2
&
b
)
const
HB_AUTO_RETURN
(
a
%
b
)
}
HB_FUNCOBJ
(
hb_mod
);
struct
{
template
<
typename
T
>
auto
template
<
typename
T
>
constexpr
auto
operator
()
(
const
T
&
a
)
const
HB_AUTO_RETURN
(
+
a
)
}
HB_FUNCOBJ
(
hb_pos
);
struct
{
template
<
typename
T
>
auto
template
<
typename
T
>
constexpr
auto
operator
()
(
const
T
&
a
)
const
HB_AUTO_RETURN
(
-
a
)
}
HB_FUNCOBJ
(
hb_neg
);
...
...
src/hb-meta.hh
浏览文件 @
2e48fd07
...
...
@@ -80,8 +80,8 @@ template <typename T> using hb_type_identity = typename hb_type_identity_t<T>::t
struct
{
template
<
typename
T
>
T
*
operator
()
(
T
&
arg
)
const
template
<
typename
T
>
constexpr
T
*
operator
()
(
T
&
arg
)
const
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
...
...
@@ -171,29 +171,29 @@ using hb_is_cr_convertible = hb_bool_constant<
/* std::move and std::forward */
template
<
typename
T
>
static
hb_remove_reference
<
T
>&&
hb_move
(
T
&&
t
)
{
return
(
hb_remove_reference
<
T
>&&
)
(
t
);
}
static
constexpr
hb_remove_reference
<
T
>&&
hb_move
(
T
&&
t
)
{
return
(
hb_remove_reference
<
T
>&&
)
(
t
);
}
template
<
typename
T
>
static
T
&&
hb_forward
(
hb_remove_reference
<
T
>&
t
)
{
return
(
T
&&
)
t
;
}
static
constexpr
T
&&
hb_forward
(
hb_remove_reference
<
T
>&
t
)
{
return
(
T
&&
)
t
;
}
template
<
typename
T
>
static
T
&&
hb_forward
(
hb_remove_reference
<
T
>&&
t
)
{
return
(
T
&&
)
t
;
}
static
constexpr
T
&&
hb_forward
(
hb_remove_reference
<
T
>&&
t
)
{
return
(
T
&&
)
t
;
}
struct
{
template
<
typename
T
>
auto
template
<
typename
T
>
constexpr
auto
operator
()
(
T
&&
v
)
const
HB_AUTO_RETURN
(
hb_forward
<
T
>
(
v
))
template
<
typename
T
>
auto
template
<
typename
T
>
constexpr
auto
operator
()
(
T
*
v
)
const
HB_AUTO_RETURN
(
*
v
)
}
HB_FUNCOBJ
(
hb_deref
);
struct
{
template
<
typename
T
>
auto
template
<
typename
T
>
constexpr
auto
operator
()
(
T
&&
v
)
const
HB_AUTO_RETURN
(
hb_forward
<
T
>
(
v
))
template
<
typename
T
>
auto
template
<
typename
T
>
constexpr
auto
operator
()
(
T
&
v
)
const
HB_AUTO_RETURN
(
hb_addressof
(
v
))
}
HB_FUNCOBJ
(
hb_ref
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录