Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
b435df3a
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看板
提交
b435df3a
编写于
9月 28, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More atomic tuneup
上级
7e6e094a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
9 addition
and
9 deletion
+9
-9
src/hb-atomic.hh
src/hb-atomic.hh
+9
-9
未找到文件。
src/hb-atomic.hh
浏览文件 @
b435df3a
...
...
@@ -119,7 +119,7 @@ static inline void _hb_memory_barrier (void)
#define hb_atomic_int_impl_add(AI, V) InterlockedExchangeAdd ((LONG *) (AI), (V))
static_assert
((
sizeof
(
LONG
)
==
sizeof
(
int
)),
""
);
#define hb_atomic_ptr_impl_cmpexch(P,O,N) (InterlockedCompareExchangePointer ((
void **) (P), (void *) (N), (void *) (O)) == (void *)
(O))
#define hb_atomic_ptr_impl_cmpexch(P,O,N) (InterlockedCompareExchangePointer ((
P), (N), (O)) ==
(O))
#elif !defined(HB_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES)
...
...
@@ -147,17 +147,17 @@ static inline int _hb_fetch_and_add (int *AI, int V)
_hb_memory_r_barrier
();
return
result
;
}
static
inline
bool
_hb_compare_and_swap_ptr
(
const
void
**
P
,
const
void
*
O
,
const
void
*
N
)
static
inline
bool
_hb_compare_and_swap_ptr
(
void
**
P
,
void
*
O
,
void
*
N
)
{
_hb_memory_w_barrier
();
int
result
=
atomic_cas_ptr
((
void
**
)
P
,
(
void
*
)
O
,
(
void
*
)
N
)
==
(
void
*
)
O
;
bool
result
=
atomic_cas_ptr
(
P
,
O
,
N
)
==
O
;
_hb_memory_r_barrier
();
return
result
;
}
#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_swap_ptr ((
const void **) (
P), (O), (N))
#define hb_atomic_ptr_impl_cmpexch(P,O,N) _hb_compare_and_swap_ptr ((P), (O), (N))
#elif !defined(HB_NO_MT) && defined(__APPLE__)
...
...
@@ -174,12 +174,12 @@ static inline bool _hb_compare_and_swap_ptr (const void **P, const void *O, cons
#define hb_atomic_int_impl_add(AI, V) (OSAtomicAdd32Barrier ((V), (AI)) - (V))
#if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 || __IPHONE_VERSION_MIN_REQUIRED >= 20100)
#define hb_atomic_ptr_impl_cmpexch(P,O,N) OSAtomicCompareAndSwapPtrBarrier ((
void *) (O), (void *) (N), (void **)
(P))
#define hb_atomic_ptr_impl_cmpexch(P,O,N) OSAtomicCompareAndSwapPtrBarrier ((
O), (N),
(P))
#else
#if __ppc64__ || __x86_64__ || __aarch64__
#define hb_atomic_ptr_impl_cmpexch(P,O,N) OSAtomicCompareAndSwap64Barrier ((int64_t) (
void *) (O), (int64_t) (void *
) (N), (int64_t*) (P))
#define hb_atomic_ptr_impl_cmpexch(P,O,N) OSAtomicCompareAndSwap64Barrier ((int64_t) (
O), (int64_t
) (N), (int64_t*) (P))
#else
#define hb_atomic_ptr_impl_cmpexch(P,O,N) OSAtomicCompareAndSwap32Barrier ((int32_t) (
void *) (O), (int32_t) (void *
) (N), (int32_t*) (P))
#define hb_atomic_ptr_impl_cmpexch(P,O,N) OSAtomicCompareAndSwap32Barrier ((int32_t) (
O), (int32_t
) (N), (int32_t*) (P))
#endif
#endif
...
...
@@ -254,7 +254,7 @@ static_assert ((sizeof (long) == sizeof (void *)), "");
#define hb_atomic_ptr_impl_get_relaxed(P) (*(P))
#endif
#ifndef hb_atomic_int_impl_set
inline
void
hb_atomic_int_impl_
g
et
(
int
*
AI
,
int
v
)
{
_hb_memory_w_barrier
();
*
AI
=
v
;
}
inline
void
hb_atomic_int_impl_
s
et
(
int
*
AI
,
int
v
)
{
_hb_memory_w_barrier
();
*
AI
=
v
;
}
#endif
#ifndef hb_atomic_int_impl_get
inline
int
hb_atomic_int_impl_get
(
int
*
AI
)
{
int
v
=
*
AI
;
_hb_memory_r_barrier
();
return
v
;
}
...
...
@@ -291,7 +291,7 @@ struct hb_atomic_ptr_t
inline
void
set_relaxed
(
T
*
v_
)
const
{
hb_atomic_ptr_impl_set_relaxed
(
&
v
,
v_
);
}
inline
T
*
get_relaxed
(
void
)
const
{
return
(
T
*
)
hb_atomic_ptr_impl_get_relaxed
(
&
v
);
}
inline
T
*
get
(
void
)
const
{
return
(
T
*
)
hb_atomic_ptr_impl_get
((
void
**
)
&
v
);
}
inline
bool
cmpexch
(
const
T
*
old
,
T
*
new_
)
const
{
return
hb_atomic_ptr_impl_cmpexch
(
&
v
,
old
,
new_
);
}
inline
bool
cmpexch
(
const
T
*
old
,
T
*
new_
)
const
{
return
hb_atomic_ptr_impl_cmpexch
((
void
**
)
&
v
,
(
void
*
)
old
,
(
void
*
)
new_
);
}
mutable
T
*
v
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录