Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
661e9ae4
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看板
提交
661e9ae4
编写于
5月 29, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[map] Add clear(), is_empty(), and get_population()
上级
b6959c33
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
70 addition
and
12 deletion
+70
-12
src/hb-map-private.hh
src/hb-map-private.hh
+18
-4
src/hb-map.cc
src/hb-map.cc
+43
-0
src/hb-map.h
src/hb-map.h
+9
-8
未找到文件。
src/hb-map-private.hh
浏览文件 @
661e9ae4
...
@@ -66,8 +66,7 @@ struct hb_map_t
...
@@ -66,8 +66,7 @@ struct hb_map_t
inline
void
init_shallow
(
void
)
inline
void
init_shallow
(
void
)
{
{
in_error
=
false
;
in_error
=
false
;
population
=
0
;
population
=
occupancy
=
0
;
occupancy
=
0
;
mask
=
0
;
mask
=
0
;
prime
=
0
;
prime
=
0
;
items
=
nullptr
;
items
=
nullptr
;
...
@@ -105,8 +104,7 @@ struct hb_map_t
...
@@ -105,8 +104,7 @@ struct hb_map_t
item_t
*
old_items
=
items
;
item_t
*
old_items
=
items
;
/* Switch to new, empty, array. */
/* Switch to new, empty, array. */
population
=
0
;
population
=
occupancy
=
0
;
occupancy
=
0
;
mask
=
new_size
-
1
;
mask
=
new_size
-
1
;
prime
=
prime_for
(
power
);
prime
=
prime_for
(
power
);
items
=
new_items
;
items
=
new_items
;
...
@@ -167,6 +165,22 @@ struct hb_map_t
...
@@ -167,6 +165,22 @@ struct hb_map_t
static
const
hb_codepoint_t
INVALID
=
HB_MAP_VALUE_INVALID
;
static
const
hb_codepoint_t
INVALID
=
HB_MAP_VALUE_INVALID
;
inline
void
clear
(
void
)
{
memset
(
items
,
0xFF
,
((
size_t
)
mask
+
1
)
*
sizeof
(
item_t
));
population
=
occupancy
=
0
;
}
inline
bool
is_empty
(
void
)
const
{
return
population
!=
0
;
}
inline
unsigned
int
get_population
()
const
{
return
population
;
}
protected:
protected:
static
HB_INTERNAL
unsigned
int
prime_for
(
unsigned
int
shift
);
static
HB_INTERNAL
unsigned
int
prime_for
(
unsigned
int
shift
);
...
...
src/hb-map.cc
浏览文件 @
661e9ae4
...
@@ -228,6 +228,49 @@ hb_map_has (const hb_map_t *map,
...
@@ -228,6 +228,49 @@ hb_map_has (const hb_map_t *map,
}
}
/**
* hb_map_clear:
* @map: a map.
*
*
*
* Since: REPLACEME
**/
void
hb_map_clear
(
hb_map_t
*
map
)
{
return
map
->
clear
();
}
/**
* hb_map_is_empty:
* @map: a map.
*
*
*
* Since: REPLACEME
**/
hb_bool_t
hb_map_is_empty
(
const
hb_map_t
*
map
)
{
return
map
->
is_empty
();
}
/**
* hb_map_get_population:
* @map: a map.
*
*
*
* Since: REPLACEME
**/
unsigned
int
hb_map_get_population
(
const
hb_map_t
*
map
)
{
return
map
->
get_population
();
}
/* Following comment and table copied from glib. */
/* Following comment and table copied from glib. */
/* Each table size has an associated prime modulo (the first prime
/* Each table size has an associated prime modulo (the first prime
* lower than the table size) used to find the initial bucket. Probing
* lower than the table size) used to find the initial bucket. Probing
...
...
src/hb-map.h
浏览文件 @
661e9ae4
...
@@ -73,20 +73,21 @@ HB_EXTERN hb_bool_t
...
@@ -73,20 +73,21 @@ HB_EXTERN hb_bool_t
hb_map_allocation_successful
(
const
hb_map_t
*
map
);
hb_map_allocation_successful
(
const
hb_map_t
*
map
);
/*
/*
HB_EXTERN void
hb_map_clear (hb_map_t *map);
HB_EXTERN hb_bool_t
hb_map_is_empty (const hb_map_t *map);
HB_EXTERN unsigned int
hb_map_get_population (const hb_map_t *map);
HB_EXTERN hb_bool_t
HB_EXTERN hb_bool_t
hb_map_is_equal (const hb_map_t *map,
hb_map_is_equal (const hb_map_t *map,
const hb_map_t *other);
const hb_map_t *other);
*/
*/
HB_EXTERN
void
hb_map_clear
(
hb_map_t
*
map
);
HB_EXTERN
hb_bool_t
hb_map_is_empty
(
const
hb_map_t
*
map
);
HB_EXTERN
unsigned
int
hb_map_get_population
(
const
hb_map_t
*
map
);
HB_EXTERN
void
HB_EXTERN
void
hb_map_set
(
hb_map_t
*
map
,
hb_map_set
(
hb_map_t
*
map
,
hb_codepoint_t
key
,
hb_codepoint_t
key
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录