Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
b189bbc4
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看板
提交
b189bbc4
编写于
3月 30, 2019
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement hashing of objects
Should be improved for hb_bytes_t.
上级
d6b28057
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
24 addition
and
1 deletion
+24
-1
src/hb-algs.hh
src/hb-algs.hh
+1
-1
src/hb-array.hh
src/hb-array.hh
+13
-0
src/hb-serialize.hh
src/hb-serialize.hh
+5
-0
src/hb-vector.hh
src/hb-vector.hh
+5
-0
未找到文件。
src/hb-algs.hh
浏览文件 @
b189bbc4
...
@@ -40,7 +40,7 @@ static const struct
...
@@ -40,7 +40,7 @@ static const struct
//{ return hb_deref_pointer (v).hash (); }
//{ return hb_deref_pointer (v).hash (); }
/* Instead, the following ugly soution: */
/* Instead, the following ugly soution: */
template
<
typename
T
,
template
<
typename
T
,
hb_enable_if
(
!
hb_is_integer
(
hb_remove_
reference
(
T
))
&&
!
hb_is_pointer
(
T
))>
hb_enable_if
(
!
hb_is_integer
(
hb_remove_
const
(
hb_remove_reference
(
T
)
))
&&
!
hb_is_pointer
(
T
))>
uint32_t
operator
()
(
T
&&
v
)
const
{
return
v
.
hash
();
}
uint32_t
operator
()
(
T
&&
v
)
const
{
return
v
.
hash
();
}
template
<
typename
T
>
template
<
typename
T
>
...
...
src/hb-array.hh
浏览文件 @
b189bbc4
...
@@ -79,6 +79,8 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
...
@@ -79,6 +79,8 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
operator
hb_array_t
<
const
Type
>
()
{
return
hb_array_t
<
const
Type
>
(
arrayZ
,
length
);
}
operator
hb_array_t
<
const
Type
>
()
{
return
hb_array_t
<
const
Type
>
(
arrayZ
,
length
);
}
template
<
typename
T
>
operator
T
*
()
const
{
return
arrayZ
;
}
template
<
typename
T
>
operator
T
*
()
const
{
return
arrayZ
;
}
uint32_t
hash
()
const
;
/*
/*
* Compare, Sort, and Search.
* Compare, Sort, and Search.
*/
*/
...
@@ -273,9 +275,20 @@ template <typename T, unsigned int length_> inline hb_sorted_array_t<T>
...
@@ -273,9 +275,20 @@ template <typename T, unsigned int length_> inline hb_sorted_array_t<T>
hb_sorted_array
(
T
(
&
array_
)[
length_
])
hb_sorted_array
(
T
(
&
array_
)[
length_
])
{
return
hb_sorted_array_t
<
T
>
(
array_
);
}
{
return
hb_sorted_array_t
<
T
>
(
array_
);
}
template
<
typename
T
>
uint32_t
hb_array_t
<
T
>::
hash
()
const
{
uint32_t
h
=
0
;
for
(
unsigned
i
=
0
;
i
<
length
;
i
++
)
h
^=
hb_hash
(
arrayZ
[
i
]);
return
h
;
}
typedef
hb_array_t
<
const
char
>
hb_bytes_t
;
typedef
hb_array_t
<
const
char
>
hb_bytes_t
;
typedef
hb_array_t
<
const
unsigned
char
>
hb_ubytes_t
;
typedef
hb_array_t
<
const
unsigned
char
>
hb_ubytes_t
;
/* TODO Specialize hashing for hb_bytes_t and hb_ubytes_t. */
//template <>
//uint32_t hb_array_t<const char>::hash () const { return 0; }
#endif
/* HB_ARRAY_HH */
#endif
/* HB_ARRAY_HH */
src/hb-serialize.hh
浏览文件 @
b189bbc4
...
@@ -58,6 +58,11 @@ struct hb_serialize_context_t
...
@@ -58,6 +58,11 @@ struct hb_serialize_context_t
&&
0
==
memcmp
(
head
,
o
.
head
,
tail
-
head
)
&&
0
==
memcmp
(
head
,
o
.
head
,
tail
-
head
)
&&
0
==
memcmp
(
&
links
,
&
o
.
links
,
links
.
get_size
());
&&
0
==
memcmp
(
&
links
,
&
o
.
links
,
links
.
get_size
());
}
}
uint32_t
hash
()
const
{
return
hb_bytes_t
(
head
,
tail
-
head
).
hash
()
^
links
.
as_bytes
().
hash
();
}
struct
link_t
struct
link_t
{
{
...
...
src/hb-vector.hh
浏览文件 @
b189bbc4
...
@@ -100,6 +100,11 @@ struct hb_vector_t
...
@@ -100,6 +100,11 @@ struct hb_vector_t
return
*
this
;
return
*
this
;
}
}
hb_bytes_t
as_bytes
()
const
{
return
hb_bytes_t
((
const
char
*
)
arrayZ_
,
length
*
item_size
);
}
uint32_t
hash
()
const
{
return
as_bytes
().
hash
();
}
const
Type
*
arrayZ
()
const
{
return
arrayZ_
;
}
const
Type
*
arrayZ
()
const
{
return
arrayZ_
;
}
Type
*
arrayZ
()
{
return
arrayZ_
;
}
Type
*
arrayZ
()
{
return
arrayZ_
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录