Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
9af33d7a
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看板
提交
9af33d7a
编写于
12月 03, 2018
作者:
M
Michiharu Ariza
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Number to use double for all types
上级
84efe043
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
71 deletion
+13
-71
src/hb-cff-interp-common.hh
src/hb-cff-interp-common.hh
+13
-71
未找到文件。
src/hb-cff-interp-common.hh
浏览文件 @
9af33d7a
...
...
@@ -218,80 +218,41 @@ inline unsigned int OpCode_Size (OpCode op) { return Is_OpCode_ESC (op) ? 2: 1;
struct
Number
{
inline
void
init
(
void
)
{
set_
int
(
0
);
}
{
set_
real
(
0.
0
);
}
inline
void
fini
(
void
)
{}
inline
void
set_int
(
int
v
)
{
format
=
NumInt
;
u
.
int_val
=
v
;
}
inline
int
to_int
(
void
)
const
{
return
is_int
()
?
u
.
int_val
:
(
int
)
to_real
()
;
}
inline
void
set_fixed
(
int32_t
v
)
{
format
=
NumFixed
;
u
.
fixed_val
=
v
;
}
inline
void
set_int
(
int
v
)
{
value
=
(
double
)
v
;
}
inline
int
to_int
(
void
)
const
{
return
(
int
)
value
;
}
inline
void
set_fixed
(
int32_t
v
)
{
value
=
v
/
65536.0
;
}
inline
int32_t
to_fixed
(
void
)
const
{
if
(
is_fixed
())
return
u
.
fixed_val
;
else
if
(
is_real
())
return
(
int32_t
)(
u
.
real_val
*
65536.0
f
);
else
return
(
int32_t
)(
u
.
int_val
<<
16
);
return
(
int32_t
)(
value
*
65536.0
);
}
inline
void
set_real
(
float
v
)
{
format
=
NumReal
;
u
.
real_val
=
v
;
}
inline
void
set_real
(
float
v
)
{
value
=
(
double
)
v
;
}
inline
float
to_real
(
void
)
const
{
if
(
is_real
())
return
u
.
real_val
;
if
(
is_fixed
())
return
u
.
fixed_val
/
65536.0
f
;
else
return
(
float
)
u
.
int_val
;
return
(
float
)
value
;
}
inline
int
ceil
(
void
)
const
{
switch
(
format
)
{
default:
case
NumInt
:
return
u
.
int_val
;
case
NumFixed
:
return
(
u
.
fixed_val
+
0xFFFF
)
>>
16
;
case
NumReal
:
return
(
int
)
ceilf
(
u
.
real_val
);
}
return
(
int
)
::
ceil
(
value
);
}
inline
int
floor
(
void
)
const
{
switch
(
format
)
{
default:
case
NumInt
:
return
u
.
int_val
;
case
NumFixed
:
return
u
.
fixed_val
>>
16
;
case
NumReal
:
return
(
int
)
floorf
(
u
.
real_val
);
}
return
(
int
)
::
floor
(
value
);
}
inline
bool
in_int_range
(
void
)
const
{
if
(
is_int
())
return
true
;
if
(
is_fixed
()
&&
((
u
.
fixed_val
&
0xFFFF
)
==
0
))
return
true
;
else
return
((
float
)(
int16_t
)
to_int
()
==
u
.
real_val
);
return
((
double
)(
int16_t
)
to_int
()
==
value
);
}
inline
bool
operator
>
(
const
Number
&
n
)
const
{
switch
(
format
)
{
default:
case
NumInt
:
return
u
.
int_val
>
n
.
to_int
();
case
NumFixed
:
return
u
.
fixed_val
>
n
.
to_fixed
();
case
NumReal
:
return
u
.
real_val
>
n
.
to_real
();
}
return
value
>
n
.
to_real
();
}
inline
bool
operator
<
(
const
Number
&
n
)
const
...
...
@@ -305,32 +266,13 @@ struct Number
inline
const
Number
&
operator
+=
(
const
Number
&
n
)
{
if
(
format
==
NumReal
||
n
.
format
==
NumReal
)
set_real
(
to_real
()
+
n
.
to_real
());
else
if
(
format
==
NumFixed
||
n
.
format
==
NumFixed
)
set_fixed
(
to_fixed
()
+
n
.
to_fixed
());
else
set_int
(
to_int
()
+
n
.
to_int
());
set_real
(
to_real
()
+
n
.
to_real
());
return
*
this
;
}
protected:
enum
NumFormat
{
NumInt
,
NumFixed
,
NumReal
};
NumFormat
format
;
union
{
int
int_val
;
int32_t
fixed_val
;
float
real_val
;
}
u
;
inline
bool
is_int
(
void
)
const
{
return
format
==
NumInt
;
}
inline
bool
is_fixed
(
void
)
const
{
return
format
==
NumFixed
;
}
inline
bool
is_real
(
void
)
const
{
return
format
==
NumReal
;
}
double
value
;
};
/* byte string */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录