Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
17f0cfa7
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看板
提交
17f0cfa7
编写于
3月 31, 2019
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move BEInt to hb.hh
I knows...
上级
78fc43f2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
89 addition
and
88 deletion
+89
-88
src/hb-machinery.hh
src/hb-machinery.hh
+0
-88
src/hb.hh
src/hb.hh
+89
-0
未找到文件。
src/hb-machinery.hh
浏览文件 @
17f0cfa7
...
...
@@ -144,94 +144,6 @@ static inline Type& StructAfter(TObject &X)
DEFINE_SIZE_ARRAY(size, array)
/*
* Big-endian integers.
*/
template
<
typename
Type
,
int
Bytes
>
struct
BEInt
;
template
<
typename
Type
>
struct
BEInt
<
Type
,
1
>
{
public:
BEInt
<
Type
,
1
>&
operator
=
(
Type
V
)
{
v
=
V
;
return
*
this
;
}
operator
Type
()
const
{
return
v
;
}
private:
uint8_t
v
;
};
template
<
typename
Type
>
struct
BEInt
<
Type
,
2
>
{
public:
BEInt
<
Type
,
2
>&
operator
=
(
Type
V
)
{
v
[
0
]
=
(
V
>>
8
)
&
0xFF
;
v
[
1
]
=
(
V
)
&
0xFF
;
return
*
this
;
}
operator
Type
()
const
{
#if ((defined(__GNUC__) && __GNUC__ >= 5) || defined(__clang__)) && \
defined(__BYTE_ORDER) && \
(__BYTE_ORDER == __LITTLE_ENDIAN || __BYTE_ORDER == __BIG_ENDIAN)
/* Spoon-feed the compiler a big-endian integer with alignment 1.
* https://github.com/harfbuzz/harfbuzz/pull/1398 */
struct
__attribute__
((
packed
))
packed_uint16_t
{
uint16_t
v
;
};
#if __BYTE_ORDER == __LITTLE_ENDIAN
return
__builtin_bswap16
(((
packed_uint16_t
*
)
this
)
->
v
);
#else
/* __BYTE_ORDER == __BIG_ENDIAN */
return
((
packed_uint16_t
*
)
this
)
->
v
;
#endif
#endif
return
(
v
[
0
]
<<
8
)
+
(
v
[
1
]
);
}
private:
uint8_t
v
[
2
];
};
template
<
typename
Type
>
struct
BEInt
<
Type
,
3
>
{
public:
BEInt
<
Type
,
3
>&
operator
=
(
Type
V
)
{
v
[
0
]
=
(
V
>>
16
)
&
0xFF
;
v
[
1
]
=
(
V
>>
8
)
&
0xFF
;
v
[
2
]
=
(
V
)
&
0xFF
;
return
*
this
;
}
operator
Type
()
const
{
return
(
v
[
0
]
<<
16
)
+
(
v
[
1
]
<<
8
)
+
(
v
[
2
]
);
}
private:
uint8_t
v
[
3
];
};
template
<
typename
Type
>
struct
BEInt
<
Type
,
4
>
{
public:
BEInt
<
Type
,
4
>&
operator
=
(
Type
V
)
{
v
[
0
]
=
(
V
>>
24
)
&
0xFF
;
v
[
1
]
=
(
V
>>
16
)
&
0xFF
;
v
[
2
]
=
(
V
>>
8
)
&
0xFF
;
v
[
3
]
=
(
V
)
&
0xFF
;
return
*
this
;
}
operator
Type
()
const
{
return
(
v
[
0
]
<<
24
)
+
(
v
[
1
]
<<
16
)
+
(
v
[
2
]
<<
8
)
+
(
v
[
3
]
);
}
private:
uint8_t
v
[
4
];
};
/*
* Lazy loaders.
...
...
src/hb.hh
浏览文件 @
17f0cfa7
...
...
@@ -553,6 +553,95 @@ _hb_memalign(void **memptr, size_t alignment, size_t size)
#endif
/*
* Big-endian integers. Here because fundamental.
*/
template
<
typename
Type
,
int
Bytes
>
struct
BEInt
;
template
<
typename
Type
>
struct
BEInt
<
Type
,
1
>
{
public:
BEInt
<
Type
,
1
>&
operator
=
(
Type
V
)
{
v
=
V
;
return
*
this
;
}
operator
Type
()
const
{
return
v
;
}
private:
uint8_t
v
;
};
template
<
typename
Type
>
struct
BEInt
<
Type
,
2
>
{
public:
BEInt
<
Type
,
2
>&
operator
=
(
Type
V
)
{
v
[
0
]
=
(
V
>>
8
)
&
0xFF
;
v
[
1
]
=
(
V
)
&
0xFF
;
return
*
this
;
}
operator
Type
()
const
{
#if ((defined(__GNUC__) && __GNUC__ >= 5) || defined(__clang__)) && \
defined(__BYTE_ORDER) && \
(__BYTE_ORDER == __LITTLE_ENDIAN || __BYTE_ORDER == __BIG_ENDIAN)
/* Spoon-feed the compiler a big-endian integer with alignment 1.
* https://github.com/harfbuzz/harfbuzz/pull/1398 */
struct
__attribute__
((
packed
))
packed_uint16_t
{
uint16_t
v
;
};
#if __BYTE_ORDER == __LITTLE_ENDIAN
return
__builtin_bswap16
(((
packed_uint16_t
*
)
this
)
->
v
);
#else
/* __BYTE_ORDER == __BIG_ENDIAN */
return
((
packed_uint16_t
*
)
this
)
->
v
;
#endif
#endif
return
(
v
[
0
]
<<
8
)
+
(
v
[
1
]
);
}
private:
uint8_t
v
[
2
];
};
template
<
typename
Type
>
struct
BEInt
<
Type
,
3
>
{
public:
BEInt
<
Type
,
3
>&
operator
=
(
Type
V
)
{
v
[
0
]
=
(
V
>>
16
)
&
0xFF
;
v
[
1
]
=
(
V
>>
8
)
&
0xFF
;
v
[
2
]
=
(
V
)
&
0xFF
;
return
*
this
;
}
operator
Type
()
const
{
return
(
v
[
0
]
<<
16
)
+
(
v
[
1
]
<<
8
)
+
(
v
[
2
]
);
}
private:
uint8_t
v
[
3
];
};
template
<
typename
Type
>
struct
BEInt
<
Type
,
4
>
{
public:
BEInt
<
Type
,
4
>&
operator
=
(
Type
V
)
{
v
[
0
]
=
(
V
>>
24
)
&
0xFF
;
v
[
1
]
=
(
V
>>
16
)
&
0xFF
;
v
[
2
]
=
(
V
>>
8
)
&
0xFF
;
v
[
3
]
=
(
V
)
&
0xFF
;
return
*
this
;
}
operator
Type
()
const
{
return
(
v
[
0
]
<<
24
)
+
(
v
[
1
]
<<
16
)
+
(
v
[
2
]
<<
8
)
+
(
v
[
3
]
);
}
private:
uint8_t
v
[
4
];
};
/*
* For lack of a better place, put Zawgyi script hack here.
* https://github.com/harfbuzz/harfbuzz/issues/1162
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录