Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
be336dad
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
接近 2 年 前同步成功
通知
1
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看板
提交
be336dad
编写于
8月 06, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move some more code around
上级
92806ee0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
44 addition
and
50 deletion
+44
-50
src/hb-dsalgs.hh
src/hb-dsalgs.hh
+43
-0
src/hb-private.hh
src/hb-private.hh
+1
-50
未找到文件。
src/hb-dsalgs.hh
浏览文件 @
be336dad
...
...
@@ -232,6 +232,18 @@ hb_ctz (T v)
* Tiny stuff.
*/
/* ASCII tag/character handling */
static
inline
bool
ISALPHA
(
unsigned
char
c
)
{
return
(
c
>=
'a'
&&
c
<=
'z'
)
||
(
c
>=
'A'
&&
c
<=
'Z'
);
}
static
inline
bool
ISALNUM
(
unsigned
char
c
)
{
return
(
c
>=
'a'
&&
c
<=
'z'
)
||
(
c
>=
'A'
&&
c
<=
'Z'
)
||
(
c
>=
'0'
&&
c
<=
'9'
);
}
static
inline
bool
ISSPACE
(
unsigned
char
c
)
{
return
c
==
' '
||
c
==
'\f'
||
c
==
'\n'
||
c
==
'\r'
||
c
==
'\t'
||
c
==
'\v'
;
}
static
inline
unsigned
char
TOUPPER
(
unsigned
char
c
)
{
return
(
c
>=
'a'
&&
c
<=
'z'
)
?
c
-
'a'
+
'A'
:
c
;
}
static
inline
unsigned
char
TOLOWER
(
unsigned
char
c
)
{
return
(
c
>=
'A'
&&
c
<=
'Z'
)
?
c
-
'A'
+
'a'
:
c
;
}
#undef MIN
template
<
typename
Type
>
static
inline
Type
MIN
(
const
Type
&
a
,
const
Type
&
b
)
{
return
a
<
b
?
a
:
b
;
}
...
...
@@ -262,6 +274,37 @@ hb_ceil_to_4 (unsigned int v)
return
((
v
-
1
)
|
3
)
+
1
;
}
template
<
typename
T
>
class
hb_assert_unsigned_t
;
template
<
>
class
hb_assert_unsigned_t
<
unsigned
char
>
{};
template
<
>
class
hb_assert_unsigned_t
<
unsigned
short
>
{};
template
<
>
class
hb_assert_unsigned_t
<
unsigned
int
>
{};
template
<
>
class
hb_assert_unsigned_t
<
unsigned
long
>
{};
template
<
typename
T
>
static
inline
bool
hb_in_range
(
T
u
,
T
lo
,
T
hi
)
{
/* The sizeof() is here to force template instantiation.
* I'm sure there are better ways to do this but can't think of
* one right now. Declaring a variable won't work as HB_UNUSED
* is unusable on some platforms and unused types are less likely
* to generate a warning than unused variables. */
static_assert
((
sizeof
(
hb_assert_unsigned_t
<
T
>
)
>=
0
),
""
);
/* The casts below are important as if T is smaller than int,
* the subtract results will become a signed int! */
return
(
T
)(
u
-
lo
)
<=
(
T
)(
hi
-
lo
);
}
template
<
typename
T
>
static
inline
bool
hb_in_ranges
(
T
u
,
T
lo1
,
T
hi1
,
T
lo2
,
T
hi2
)
{
return
hb_in_range
(
u
,
lo1
,
hi1
)
||
hb_in_range
(
u
,
lo2
,
hi2
);
}
template
<
typename
T
>
static
inline
bool
hb_in_ranges
(
T
u
,
T
lo1
,
T
hi1
,
T
lo2
,
T
hi2
,
T
lo3
,
T
hi3
)
{
return
hb_in_range
(
u
,
lo1
,
hi1
)
||
hb_in_range
(
u
,
lo2
,
hi2
)
||
hb_in_range
(
u
,
lo3
,
hi3
);
}
/*
* Sort and search.
...
...
src/hb-private.hh
浏览文件 @
be336dad
...
...
@@ -435,20 +435,6 @@ struct CrapOrNull<const Type> {
#define CrapOrNull(Type) CrapOrNull<Type>::get ()
/* ASCII tag/character handling */
static
inline
bool
ISALPHA
(
unsigned
char
c
)
{
return
(
c
>=
'a'
&&
c
<=
'z'
)
||
(
c
>=
'A'
&&
c
<=
'Z'
);
}
static
inline
bool
ISALNUM
(
unsigned
char
c
)
{
return
(
c
>=
'a'
&&
c
<=
'z'
)
||
(
c
>=
'A'
&&
c
<=
'Z'
)
||
(
c
>=
'0'
&&
c
<=
'9'
);
}
static
inline
bool
ISSPACE
(
unsigned
char
c
)
{
return
c
==
' '
||
c
==
'\f'
||
c
==
'\n'
||
c
==
'\r'
||
c
==
'\t'
||
c
==
'\v'
;
}
static
inline
unsigned
char
TOUPPER
(
unsigned
char
c
)
{
return
(
c
>=
'a'
&&
c
<=
'z'
)
?
c
-
'a'
+
'A'
:
c
;
}
static
inline
unsigned
char
TOLOWER
(
unsigned
char
c
)
{
return
(
c
>=
'A'
&&
c
<=
'Z'
)
?
c
-
'A'
+
'a'
:
c
;
}
/* HB_NDEBUG disables some sanity checks that are very safe to disable and
* should be disabled in production systems. If NDEBUG is defined, enable
* HB_NDEBUG; but if it's desirable that normal assert()s (which are very
...
...
@@ -459,41 +445,7 @@ static inline unsigned char TOLOWER (unsigned char c)
#endif
/* Misc */
template
<
typename
T
>
class
hb_assert_unsigned_t
;
template
<
>
class
hb_assert_unsigned_t
<
unsigned
char
>
{};
template
<
>
class
hb_assert_unsigned_t
<
unsigned
short
>
{};
template
<
>
class
hb_assert_unsigned_t
<
unsigned
int
>
{};
template
<
>
class
hb_assert_unsigned_t
<
unsigned
long
>
{};
template
<
typename
T
>
static
inline
bool
hb_in_range
(
T
u
,
T
lo
,
T
hi
)
{
/* The sizeof() is here to force template instantiation.
* I'm sure there are better ways to do this but can't think of
* one right now. Declaring a variable won't work as HB_UNUSED
* is unusable on some platforms and unused types are less likely
* to generate a warning than unused variables. */
static_assert
((
sizeof
(
hb_assert_unsigned_t
<
T
>
)
>=
0
),
""
);
/* The casts below are important as if T is smaller than int,
* the subtract results will become a signed int! */
return
(
T
)(
u
-
lo
)
<=
(
T
)(
hi
-
lo
);
}
template
<
typename
T
>
static
inline
bool
hb_in_ranges
(
T
u
,
T
lo1
,
T
hi1
,
T
lo2
,
T
hi2
)
{
return
hb_in_range
(
u
,
lo1
,
hi1
)
||
hb_in_range
(
u
,
lo2
,
hi2
);
}
template
<
typename
T
>
static
inline
bool
hb_in_ranges
(
T
u
,
T
lo1
,
T
hi1
,
T
lo2
,
T
hi2
,
T
lo3
,
T
hi3
)
{
return
hb_in_range
(
u
,
lo1
,
hi1
)
||
hb_in_range
(
u
,
lo2
,
hi2
)
||
hb_in_range
(
u
,
lo3
,
hi3
);
}
/* Flags */
/* Enable bitwise ops on enums marked as flags_t */
/* To my surprise, looks like the function resolver is happy to silently cast
...
...
@@ -517,7 +469,6 @@ hb_in_ranges (T u, T lo1, T hi1, T lo2, T hi2, T lo3, T hi3)
static inline T& operator ^= (T& l, T r) { l = l ^ r; return l; } \
}
/* Useful for set-operations on small enums.
* For example, for testing "x ∈ {x1, x2, x3}" use:
* (FLAG_UNSAFE(x) & (FLAG(x1) | FLAG(x2) | FLAG(x3)))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录