Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
4e626278
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
1 年多 前同步成功
通知
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看板
提交
4e626278
编写于
9月 16, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enforce single-param static_assert() only
So we don't accidentally break it again.
上级
f1a86e1e
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
60 addition
and
56 deletion
+60
-56
src/hb-atomic.hh
src/hb-atomic.hh
+2
-2
src/hb-buffer.cc
src/hb-buffer.cc
+1
-1
src/hb-buffer.hh
src/hb-buffer.hh
+2
-2
src/hb-cache.hh
src/hb-cache.hh
+2
-2
src/hb-coretext.cc
src/hb-coretext.cc
+1
-1
src/hb-debug.hh
src/hb-debug.hh
+1
-1
src/hb-dsalgs.hh
src/hb-dsalgs.hh
+2
-2
src/hb-machinery.hh
src/hb-machinery.hh
+2
-2
src/hb-null.hh
src/hb-null.hh
+4
-4
src/hb-open-type.hh
src/hb-open-type.hh
+2
-2
src/hb-ot-layout-common.hh
src/hb-ot-layout-common.hh
+1
-1
src/hb-ot-layout-gdef-table.hh
src/hb-ot-layout-gdef-table.hh
+3
-3
src/hb-ot-layout.cc
src/hb-ot-layout.cc
+7
-7
src/hb-ot-map.cc
src/hb-ot-map.cc
+1
-1
src/hb-ot-math-table.hh
src/hb-ot-math-table.hh
+1
-1
src/hb-ot-shape-complex-arabic-fallback.hh
src/hb-ot-shape-complex-arabic-fallback.hh
+1
-1
src/hb-ot-shape-complex-indic.hh
src/hb-ot-shape-complex-indic.hh
+1
-1
src/hb-ot-shape-complex-use.cc
src/hb-ot-shape-complex-use.cc
+1
-1
src/hb-set-digest.hh
src/hb-set-digest.hh
+2
-2
src/hb-set.hh
src/hb-set.hh
+3
-3
src/hb-uniscribe.cc
src/hb-uniscribe.cc
+1
-1
src/hb.hh
src/hb.hh
+19
-15
未找到文件。
src/hb-atomic.hh
浏览文件 @
4e626278
...
...
@@ -107,7 +107,7 @@ static inline void _hb_memory_barrier (void)
#define _hb_memory_barrier() _hb_memory_barrier ()
#define hb_atomic_int_impl_add(AI, V) InterlockedExchangeAdd ((LONG *) (AI), (V))
static_assert
((
sizeof
(
LONG
)
==
sizeof
(
int
))
,
""
);
static_assert
((
sizeof
(
LONG
)
==
sizeof
(
int
)));
#define hb_atomic_ptr_impl_cmpexch(P,O,N) (InterlockedCompareExchangePointer ((void **) (P), (void *) (N), (void *) (O)) == (void *) (O))
...
...
@@ -198,7 +198,7 @@ static inline bool _hb_compare_and_swaplp (long *P, long O, long N)
#define hb_atomic_int_impl_add(AI, V) _hb_fetch_and_add ((AI), (V))
#define hb_atomic_ptr_impl_cmpexch(P,O,N) _hb_compare_and_swaplp ((long *) (P), (long) (O), (long) (N))
static_assert
((
sizeof
(
long
)
==
sizeof
(
void
*
))
,
""
);
static_assert
((
sizeof
(
long
)
==
sizeof
(
void
*
)));
#elif !defined(HB_NO_MT)
...
...
src/hb-buffer.cc
浏览文件 @
4e626278
...
...
@@ -130,7 +130,7 @@ hb_buffer_t::enlarge (unsigned int size)
while
(
size
>=
new_allocated
)
new_allocated
+=
(
new_allocated
>>
1
)
+
32
;
static_assert
((
sizeof
(
info
[
0
])
==
sizeof
(
pos
[
0
]))
,
""
);
static_assert
((
sizeof
(
info
[
0
])
==
sizeof
(
pos
[
0
])));
if
(
unlikely
(
hb_unsigned_mul_overflows
(
new_allocated
,
sizeof
(
info
[
0
]))))
goto
done
;
...
...
src/hb-buffer.hh
浏览文件 @
4e626278
...
...
@@ -54,8 +54,8 @@
#define HB_BUFFER_MAX_OPS_DEFAULT 0x1FFFFFFF
/* Shaping more than a billion operations? Let us know! */
#endif
static_assert
((
sizeof
(
hb_glyph_info_t
)
==
20
)
,
""
);
static_assert
((
sizeof
(
hb_glyph_info_t
)
==
sizeof
(
hb_glyph_position_t
))
,
""
);
static_assert
((
sizeof
(
hb_glyph_info_t
)
==
20
));
static_assert
((
sizeof
(
hb_glyph_info_t
)
==
sizeof
(
hb_glyph_position_t
)));
HB_MARK_AS_FLAG_T
(
hb_buffer_flags_t
);
HB_MARK_AS_FLAG_T
(
hb_buffer_serialize_flags_t
);
...
...
src/hb-cache.hh
浏览文件 @
4e626278
...
...
@@ -35,8 +35,8 @@
template
<
unsigned
int
key_bits
,
unsigned
int
value_bits
,
unsigned
int
cache_bits
>
struct
hb_cache_t
{
static_assert
((
key_bits
>=
cache_bits
)
,
""
);
static_assert
((
key_bits
+
value_bits
-
cache_bits
<=
8
*
sizeof
(
unsigned
int
))
,
""
);
static_assert
((
key_bits
>=
cache_bits
));
static_assert
((
key_bits
+
value_bits
-
cache_bits
<=
8
*
sizeof
(
unsigned
int
)));
inline
void
init
(
void
)
{
clear
();
}
inline
void
fini
(
void
)
{}
...
...
src/hb-coretext.cc
浏览文件 @
4e626278
...
...
@@ -720,7 +720,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
CFNumberCreate
(
kCFAllocatorDefault
,
kCFNumberIntType
,
&
active_features
[
j
].
rec
.
feature
),
CFNumberCreate
(
kCFAllocatorDefault
,
kCFNumberIntType
,
&
active_features
[
j
].
rec
.
setting
)
};
static_assert
((
ARRAY_LENGTH_CONST
(
keys
)
==
ARRAY_LENGTH_CONST
(
values
))
,
""
);
static_assert
((
ARRAY_LENGTH_CONST
(
keys
)
==
ARRAY_LENGTH_CONST
(
values
)));
CFDictionaryRef
dict
=
CFDictionaryCreate
(
kCFAllocatorDefault
,
(
const
void
**
)
keys
,
(
const
void
**
)
values
,
...
...
src/hb-debug.hh
浏览文件 @
4e626278
...
...
@@ -52,7 +52,7 @@ union hb_options_union_t {
int
i
;
hb_options_t
opts
;
};
static_assert
((
sizeof
(
hb_atomic_int_t
)
>=
sizeof
(
hb_options_union_t
))
,
""
);
static_assert
((
sizeof
(
hb_atomic_int_t
)
>=
sizeof
(
hb_options_union_t
)));
HB_INTERNAL
void
_hb_options_init
(
void
);
...
...
src/hb-dsalgs.hh
浏览文件 @
4e626278
...
...
@@ -290,7 +290,7 @@ hb_in_range (T u, T lo, T hi)
* 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
)
,
""
);
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! */
...
...
@@ -628,7 +628,7 @@ struct hb_vector_size_t
}
private:
static_assert
(
byte_size
/
sizeof
(
elt_t
)
*
sizeof
(
elt_t
)
==
byte_size
,
""
);
static_assert
(
byte_size
/
sizeof
(
elt_t
)
*
sizeof
(
elt_t
)
==
byte_size
);
union
{
elt_t
v
[
byte_size
/
sizeof
(
elt_t
)];
#if HB_VECTOR_SIZE
...
...
src/hb-machinery.hh
浏览文件 @
4e626278
...
...
@@ -83,7 +83,7 @@ static inline Type& StructAfter(TObject &X)
#define _DEFINE_INSTANCE_ASSERTION1(_line, _assertion) \
inline void _instance_assertion_on_line_##_line (void) const \
{ \
static_assert ((_assertion)
, ""
); \
static_assert ((_assertion)); \
ASSERT_INSTANCE_POD (*this);
/* Make sure it's POD. */
\
}
# define _DEFINE_INSTANCE_ASSERTION0(_line, _assertion) _DEFINE_INSTANCE_ASSERTION1 (_line, _assertion)
...
...
@@ -704,7 +704,7 @@ struct BEInt<Type, 4>
template
<
typename
Data
,
unsigned
int
WheresData
>
struct
hb_data_wrapper_t
{
static_assert
(
WheresData
>
0
,
""
);
static_assert
(
WheresData
>
0
);
inline
Data
*
get_data
(
void
)
const
{
...
...
src/hb-null.hh
浏览文件 @
4e626278
...
...
@@ -44,7 +44,7 @@ hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_
/* Generic nul-content Null objects. */
template
<
typename
Type
>
static
inline
Type
const
&
Null
(
void
)
{
static_assert
(
sizeof
(
Type
)
<=
HB_NULL_POOL_SIZE
,
"Increase HB_NULL_POOL_SIZE."
);
static_assert
(
sizeof
(
Type
)
<=
HB_NULL_POOL_SIZE
);
return
*
reinterpret_cast
<
Type
const
*>
(
_hb_NullPool
);
}
#define Null(Type) Null<Type>()
...
...
@@ -58,7 +58,7 @@ static inline Type const & Null (void) {
return *reinterpret_cast<const Namespace::Type *> (_hb_Null_##Namespace##_##Type); \
} \
namespace Namespace { \
static_assert (true
, "Just so we take semicolon after.")
static_assert (true
)
/* Just so we take semicolon after. */
#define DEFINE_NULL_NAMESPACE_BYTES(Namespace, Type) \
const unsigned char _hb_Null_##Namespace##_##Type[Namespace::Type::min_size]
...
...
@@ -69,7 +69,7 @@ static inline Type const & Null (void) {
/*static*/
inline const Type& Null<Type> (void) { \
return _hb_Null_##Type; \
} \
static_assert (true, "Just so we take semicolon after.")
static_assert (true)
/* Just so we take semicolon after. */
#define DEFINE_NULL_INSTANCE(Type) \
const Type _hb_Null_##Type
...
...
@@ -85,7 +85,7 @@ extern HB_INTERNAL
/* CRAP pool: Common Region for Access Protection. */
template
<
typename
Type
>
static
inline
Type
&
Crap
(
void
)
{
static_assert
(
sizeof
(
Type
)
<=
HB_NULL_POOL_SIZE
,
"Increase HB_NULL_POOL_SIZE."
);
static_assert
(
sizeof
(
Type
)
<=
HB_NULL_POOL_SIZE
);
Type
*
obj
=
reinterpret_cast
<
Type
*>
(
_hb_CrapPool
);
*
obj
=
Null
(
Type
);
return
*
obj
;
...
...
src/hb-open-type.hh
浏览文件 @
4e626278
...
...
@@ -226,13 +226,13 @@ struct FixedVersion
* Use: (base+offset)
*/
template
<
typename
Type
,
bool
has_null_
>
struct
assert_has_min_size
{
static_assert
(
Type
::
min_size
>
0
,
""
);
};
template
<
typename
Type
,
bool
has_null_
>
struct
assert_has_min_size
{
static_assert
(
Type
::
min_size
>
0
);
};
template
<
typename
Type
>
struct
assert_has_min_size
<
Type
,
false
>
{};
template
<
typename
Type
,
typename
OffsetType
=
HBUINT16
,
bool
has_null
=
true
>
struct
OffsetTo
:
Offset
<
OffsetType
,
has_null
>
{
static_assert
(
sizeof
(
assert_has_min_size
<
Type
,
has_null
>
)
||
true
,
""
);
static_assert
(
sizeof
(
assert_has_min_size
<
Type
,
has_null
>
)
||
true
);
inline
const
Type
&
operator
()
(
const
void
*
base
)
const
{
...
...
src/hb-ot-layout-common.hh
浏览文件 @
4e626278
...
...
@@ -800,7 +800,7 @@ struct CoverageFormat1
inline
unsigned
int
get_coverage
(
hb_codepoint_t
glyph_id
)
const
{
int
i
=
glyphArray
.
bsearch
(
glyph_id
);
static_assert
((((
unsigned
int
)
-
1
)
==
NOT_COVERED
)
,
""
);
static_assert
((((
unsigned
int
)
-
1
)
==
NOT_COVERED
));
return
i
;
}
...
...
src/hb-ot-layout-gdef-table.hh
浏览文件 @
4e626278
...
...
@@ -394,9 +394,9 @@ struct GDEF
{
unsigned
int
klass
=
get_glyph_class
(
glyph
);
static_assert
(((
unsigned
int
)
HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH
==
(
unsigned
int
)
LookupFlag
::
IgnoreBaseGlyphs
)
,
""
);
static_assert
(((
unsigned
int
)
HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE
==
(
unsigned
int
)
LookupFlag
::
IgnoreLigatures
)
,
""
);
static_assert
(((
unsigned
int
)
HB_OT_LAYOUT_GLYPH_PROPS_MARK
==
(
unsigned
int
)
LookupFlag
::
IgnoreMarks
)
,
""
);
static_assert
(((
unsigned
int
)
HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH
==
(
unsigned
int
)
LookupFlag
::
IgnoreBaseGlyphs
));
static_assert
(((
unsigned
int
)
HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE
==
(
unsigned
int
)
LookupFlag
::
IgnoreLigatures
));
static_assert
(((
unsigned
int
)
HB_OT_LAYOUT_GLYPH_PROPS_MARK
==
(
unsigned
int
)
LookupFlag
::
IgnoreMarks
));
switch
(
klass
)
{
default:
return
0
;
...
...
src/hb-ot-layout.cc
浏览文件 @
4e626278
...
...
@@ -320,7 +320,7 @@ hb_ot_layout_table_find_script (hb_face_t *face,
hb_tag_t
script_tag
,
unsigned
int
*
script_index
)
{
static_assert
((
OT
::
Index
::
NOT_FOUND_INDEX
==
HB_OT_LAYOUT_NO_SCRIPT_INDEX
)
,
""
);
static_assert
((
OT
::
Index
::
NOT_FOUND_INDEX
==
HB_OT_LAYOUT_NO_SCRIPT_INDEX
));
const
OT
::
GSUBGPOS
&
g
=
get_gsubgpos_table
(
face
,
table_tag
);
if
(
g
.
find_script_index
(
script_tag
,
script_index
))
...
...
@@ -351,7 +351,7 @@ hb_ot_layout_table_choose_script (hb_face_t *face,
unsigned
int
*
script_index
,
hb_tag_t
*
chosen_script
)
{
static_assert
((
OT
::
Index
::
NOT_FOUND_INDEX
==
HB_OT_LAYOUT_NO_SCRIPT_INDEX
)
,
""
);
static_assert
((
OT
::
Index
::
NOT_FOUND_INDEX
==
HB_OT_LAYOUT_NO_SCRIPT_INDEX
));
const
OT
::
GSUBGPOS
&
g
=
get_gsubgpos_table
(
face
,
table_tag
);
while
(
*
script_tags
)
...
...
@@ -410,7 +410,7 @@ hb_ot_layout_table_find_feature (hb_face_t *face,
hb_tag_t
feature_tag
,
unsigned
int
*
feature_index
)
{
static_assert
((
OT
::
Index
::
NOT_FOUND_INDEX
==
HB_OT_LAYOUT_NO_FEATURE_INDEX
)
,
""
);
static_assert
((
OT
::
Index
::
NOT_FOUND_INDEX
==
HB_OT_LAYOUT_NO_FEATURE_INDEX
));
const
OT
::
GSUBGPOS
&
g
=
get_gsubgpos_table
(
face
,
table_tag
);
unsigned
int
num_features
=
g
.
get_feature_count
();
...
...
@@ -447,7 +447,7 @@ hb_ot_layout_script_find_language (hb_face_t *face,
hb_tag_t
language_tag
,
unsigned
int
*
language_index
)
{
static_assert
((
OT
::
Index
::
NOT_FOUND_INDEX
==
HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX
)
,
""
);
static_assert
((
OT
::
Index
::
NOT_FOUND_INDEX
==
HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX
));
const
OT
::
Script
&
s
=
get_gsubgpos_table
(
face
,
table_tag
).
get_script
(
script_index
);
if
(
s
.
find_lang_sys_index
(
language_tag
,
language_index
))
...
...
@@ -539,7 +539,7 @@ hb_ot_layout_language_get_feature_tags (hb_face_t *face,
const
OT
::
GSUBGPOS
&
g
=
get_gsubgpos_table
(
face
,
table_tag
);
const
OT
::
LangSys
&
l
=
g
.
get_script
(
script_index
).
get_lang_sys
(
language_index
);
static_assert
((
sizeof
(
unsigned
int
)
==
sizeof
(
hb_tag_t
))
,
""
);
static_assert
((
sizeof
(
unsigned
int
)
==
sizeof
(
hb_tag_t
)));
unsigned
int
ret
=
l
.
get_feature_indexes
(
start_offset
,
feature_count
,
(
unsigned
int
*
)
feature_tags
);
if
(
feature_tags
)
{
...
...
@@ -560,7 +560,7 @@ hb_ot_layout_language_find_feature (hb_face_t *face,
hb_tag_t
feature_tag
,
unsigned
int
*
feature_index
)
{
static_assert
((
OT
::
Index
::
NOT_FOUND_INDEX
==
HB_OT_LAYOUT_NO_FEATURE_INDEX
)
,
""
);
static_assert
((
OT
::
Index
::
NOT_FOUND_INDEX
==
HB_OT_LAYOUT_NO_FEATURE_INDEX
));
const
OT
::
GSUBGPOS
&
g
=
get_gsubgpos_table
(
face
,
table_tag
);
const
OT
::
LangSys
&
l
=
g
.
get_script
(
script_index
).
get_lang_sys
(
language_index
);
...
...
@@ -869,7 +869,7 @@ hb_ot_layout_feature_with_variations_get_lookups (hb_face_t *face,
unsigned
int
*
lookup_count
/* IN/OUT */
,
unsigned
int
*
lookup_indexes
/* OUT */
)
{
static_assert
((
OT
::
FeatureVariations
::
NOT_FOUND_INDEX
==
HB_OT_LAYOUT_NO_VARIATIONS_INDEX
)
,
""
);
static_assert
((
OT
::
FeatureVariations
::
NOT_FOUND_INDEX
==
HB_OT_LAYOUT_NO_VARIATIONS_INDEX
));
const
OT
::
GSUBGPOS
&
g
=
get_gsubgpos_table
(
face
,
table_tag
);
const
OT
::
Feature
&
f
=
g
.
get_feature_variation
(
feature_index
,
variations_index
);
...
...
src/hb-ot-map.cc
浏览文件 @
4e626278
...
...
@@ -145,7 +145,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m,
const
int
*
coords
,
unsigned
int
num_coords
)
{
static_assert
((
!
(
HB_GLYPH_FLAG_DEFINED
&
(
HB_GLYPH_FLAG_DEFINED
+
1
)))
,
""
);
static_assert
((
!
(
HB_GLYPH_FLAG_DEFINED
&
(
HB_GLYPH_FLAG_DEFINED
+
1
))));
unsigned
int
global_bit_mask
=
HB_GLYPH_FLAG_DEFINED
+
1
;
unsigned
int
global_bit_shift
=
hb_popcount
(
HB_GLYPH_FLAG_DEFINED
);
...
...
src/hb-ot-math-table.hh
浏览文件 @
4e626278
...
...
@@ -463,7 +463,7 @@ struct MathGlyphPartRecord
out
.
full_advance
=
font
->
em_scale
(
fullAdvance
,
scale
);
static_assert
((
unsigned
int
)
HB_MATH_GLYPH_PART_FLAG_EXTENDER
==
(
unsigned
int
)
PartFlags
::
Extender
,
""
);
(
unsigned
int
)
PartFlags
::
Extender
);
out
.
flags
=
(
hb_ot_math_glyph_part_flags_t
)
(
unsigned
int
)
...
...
src/hb-ot-shape-complex-arabic-fallback.hh
浏览文件 @
4e626278
...
...
@@ -269,7 +269,7 @@ arabic_fallback_plan_init_unicode (arabic_fallback_plan_t *fallback_plan,
const
hb_ot_shape_plan_t
*
plan
,
hb_font_t
*
font
)
{
static_assert
((
ARRAY_LENGTH_CONST
(
arabic_fallback_features
)
<=
ARABIC_FALLBACK_MAX_LOOKUPS
)
,
""
);
static_assert
((
ARRAY_LENGTH_CONST
(
arabic_fallback_features
)
<=
ARABIC_FALLBACK_MAX_LOOKUPS
));
unsigned
int
j
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
ARRAY_LENGTH
(
arabic_fallback_features
)
;
i
++
)
{
...
...
src/hb-ot-shape-complex-indic.hh
浏览文件 @
4e626278
...
...
@@ -349,7 +349,7 @@ set_indic_properties (hb_glyph_info_t &info)
0x1CEEu
,
0x1CF1u
)))
{
cat
=
OT_Symbol
;
static_assert
(((
int
)
INDIC_SYLLABIC_CATEGORY_AVAGRAHA
==
OT_Symbol
)
,
""
);
static_assert
(((
int
)
INDIC_SYLLABIC_CATEGORY_AVAGRAHA
==
OT_Symbol
));
}
else
if
(
unlikely
(
u
==
0x0A51u
))
{
...
...
src/hb-ot-shape-complex-use.cc
浏览文件 @
4e626278
...
...
@@ -292,7 +292,7 @@ setup_topographical_masks (const hb_ot_shape_plan_t *plan,
if
(
use_plan
->
arabic_plan
)
return
;
static_assert
((
INIT
<
4
&&
ISOL
<
4
&&
MEDI
<
4
&&
FINA
<
4
)
,
""
);
static_assert
((
INIT
<
4
&&
ISOL
<
4
&&
MEDI
<
4
&&
FINA
<
4
));
hb_mask_t
masks
[
4
],
all_masks
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
4
;
i
++
)
{
...
...
src/hb-set-digest.hh
浏览文件 @
4e626278
...
...
@@ -60,8 +60,8 @@ struct hb_set_digest_lowest_bits_t
+
(
mask_bytes
>=
16
?
1
:
0
)
+
0
;
static_assert
((
shift
<
sizeof
(
hb_codepoint_t
)
*
8
)
,
""
);
static_assert
((
shift
+
num_bits
<=
sizeof
(
hb_codepoint_t
)
*
8
)
,
""
);
static_assert
((
shift
<
sizeof
(
hb_codepoint_t
)
*
8
));
static_assert
((
shift
+
num_bits
<=
sizeof
(
hb_codepoint_t
)
*
8
));
inline
void
init
(
void
)
{
mask
=
0
;
...
...
src/hb-set.hh
浏览文件 @
4e626278
...
...
@@ -158,7 +158,7 @@ struct hb_set_t
typedef
unsigned
long
long
elt_t
;
enum
{
PAGE_BITS
=
512
};
static_assert
((
PAGE_BITS
&
((
PAGE_BITS
)
-
1
))
==
0
,
""
);
static_assert
((
PAGE_BITS
&
((
PAGE_BITS
)
-
1
))
==
0
);
static
inline
unsigned
int
elt_get_min
(
const
elt_t
&
elt
)
{
return
hb_ctz
(
elt
);
}
static
inline
unsigned
int
elt_get_max
(
const
elt_t
&
elt
)
{
return
hb_bit_storage
(
elt
)
-
1
;
}
...
...
@@ -169,7 +169,7 @@ struct hb_set_t
enum
{
ELT_MASK
=
ELT_BITS
-
1
};
enum
{
BITS
=
sizeof
(
vector_t
)
*
8
};
enum
{
MASK
=
BITS
-
1
};
static_assert
((
unsigned
)
PAGE_BITS
==
(
unsigned
)
BITS
,
""
);
static_assert
((
unsigned
)
PAGE_BITS
==
(
unsigned
)
BITS
);
elt_t
&
elt
(
hb_codepoint_t
g
)
{
return
v
[(
g
&
MASK
)
/
ELT_BITS
];
}
elt_t
const
&
elt
(
hb_codepoint_t
g
)
const
{
return
v
[(
g
&
MASK
)
/
ELT_BITS
];
}
...
...
@@ -177,7 +177,7 @@ struct hb_set_t
vector_t
v
;
};
static_assert
(
page_t
::
PAGE_BITS
==
sizeof
(
page_t
)
*
8
,
""
);
static_assert
(
page_t
::
PAGE_BITS
==
sizeof
(
page_t
)
*
8
);
hb_object_header_t
header
;
bool
successful
;
/* Allocations successful */
...
...
src/hb-uniscribe.cc
浏览文件 @
4e626278
...
...
@@ -327,7 +327,7 @@ _hb_generate_unique_face_name (wchar_t *face_name, unsigned int *plen)
const
char
*
enc
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-"
;
UUID
id
;
UuidCreate
((
UUID
*
)
&
id
);
static_assert
((
2
+
3
*
(
16
/
2
)
<
LF_FACESIZE
)
,
""
);
static_assert
((
2
+
3
*
(
16
/
2
)
<
LF_FACESIZE
));
unsigned
int
name_str_len
=
0
;
face_name
[
name_str_len
++
]
=
'F'
;
face_name
[
name_str_len
++
]
=
'_'
;
...
...
src/hb.hh
浏览文件 @
4e626278
...
...
@@ -99,7 +99,7 @@ extern "C" int hb_memalign_impl(void **memptr, size_t alignment, size_t size);
#endif
#ifndef static_assert
#define static_assert(e
, msg
) \
#define static_assert(e) \
HB_UNUSED typedef int HB_PASTE(static_assertion_failed_at_line_, __LINE__) [(e) ? 1 : -1]
#endif // static_assert
...
...
@@ -137,6 +137,10 @@ struct _hb_alignof
#define explicit_operator explicit
#endif
#if __cplusplus < 201703L || true
/* Only allow single-arg form. */
#define static_assert(x) static_assert(x, "")
#endif
#endif
/* __cplusplus < 201103L */
...
...
@@ -304,18 +308,18 @@ template <> class hb_assert_constant_t<1> {};
#define ASSERT_STATIC_EXPR_ZERO(_cond) (0 * (unsigned int) sizeof (hb_assert_constant_t<_cond>))
/* Lets assert int types. Saves trouble down the road. */
static_assert
((
sizeof
(
int8_t
)
==
1
)
,
""
);
static_assert
((
sizeof
(
uint8_t
)
==
1
)
,
""
);
static_assert
((
sizeof
(
int16_t
)
==
2
)
,
""
);
static_assert
((
sizeof
(
uint16_t
)
==
2
)
,
""
);
static_assert
((
sizeof
(
int32_t
)
==
4
)
,
""
);
static_assert
((
sizeof
(
uint32_t
)
==
4
)
,
""
);
static_assert
((
sizeof
(
int64_t
)
==
8
)
,
""
);
static_assert
((
sizeof
(
uint64_t
)
==
8
)
,
""
);
static_assert
((
sizeof
(
hb_codepoint_t
)
==
4
)
,
""
);
static_assert
((
sizeof
(
hb_position_t
)
==
4
)
,
""
);
static_assert
((
sizeof
(
hb_mask_t
)
==
4
)
,
""
);
static_assert
((
sizeof
(
hb_var_int_t
)
==
4
)
,
""
);
static_assert
((
sizeof
(
int8_t
)
==
1
));
static_assert
((
sizeof
(
uint8_t
)
==
1
));
static_assert
((
sizeof
(
int16_t
)
==
2
));
static_assert
((
sizeof
(
uint16_t
)
==
2
));
static_assert
((
sizeof
(
int32_t
)
==
4
));
static_assert
((
sizeof
(
uint32_t
)
==
4
));
static_assert
((
sizeof
(
int64_t
)
==
8
));
static_assert
((
sizeof
(
uint64_t
)
==
8
));
static_assert
((
sizeof
(
hb_codepoint_t
)
==
4
));
static_assert
((
sizeof
(
hb_position_t
)
==
4
));
static_assert
((
sizeof
(
hb_mask_t
)
==
4
));
static_assert
((
sizeof
(
hb_var_int_t
)
==
4
));
/* We like our types POD */
...
...
@@ -372,8 +376,8 @@ static_assert ((sizeof (hb_var_int_t) == 4), "");
# define HB_VECTOR_SIZE 0
# endif
#endif
static_assert
(
0
==
(
HB_VECTOR_SIZE
&
(
HB_VECTOR_SIZE
-
1
))
,
"HB_VECTOR_SIZE is not power of 2."
);
static_assert
(
0
==
(
HB_VECTOR_SIZE
%
64
)
,
"HB_VECTOR_SIZE is not multiple of 64."
);
static_assert
(
0
==
(
HB_VECTOR_SIZE
&
(
HB_VECTOR_SIZE
-
1
)));
static_assert
(
0
==
(
HB_VECTOR_SIZE
%
64
));
#if HB_VECTOR_SIZE
typedef
uint64_t
hb_vector_size_impl_t
__attribute__
((
vector_size
(
HB_VECTOR_SIZE
/
8
)));
#else
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录