Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
1227a9e5
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
大约 1 年 前同步成功
通知
0
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1227a9e5
编写于
8月 08, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[atomic] Unify typedef
Removes volatile from fallback implementation. That was handwavy anyway.
上级
5cd1888c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
8 addition
and
14 deletion
+8
-14
src/hb-atomic-private.hh
src/hb-atomic-private.hh
+8
-14
未找到文件。
src/hb-atomic-private.hh
浏览文件 @
1227a9e5
...
@@ -35,7 +35,12 @@
...
@@ -35,7 +35,12 @@
#include "hb-private.hh"
#include "hb-private.hh"
/* atomic_int */
/*
* Atomic integers and pointers.
*/
typedef
int
hb_atomic_int_impl_t
;
/* We need external help for these */
/* We need external help for these */
...
@@ -43,14 +48,13 @@
...
@@ -43,14 +48,13 @@
&& defined(hb_atomic_ptr_impl_get) \
&& defined(hb_atomic_ptr_impl_get) \
&& defined(hb_atomic_ptr_impl_cmpexch)
&& defined(hb_atomic_ptr_impl_cmpexch)
/* Defined externally, i.e. in config.h
; must have typedef'ed hb_atomic_int_impl_t as well
. */
/* Defined externally, i.e. in config.h. */
#elif !defined(HB_NO_MT) && defined(__ATOMIC_CONSUME)
#elif !defined(HB_NO_MT) && defined(__ATOMIC_CONSUME)
/* C++11-style GCC primitives. */
/* C++11-style GCC primitives. */
typedef
int
hb_atomic_int_impl_t
;
#define hb_atomic_int_impl_add(AI, V) __atomic_fetch_add ((AI), (V), __ATOMIC_ACQ_REL)
#define hb_atomic_int_impl_add(AI, V) __atomic_fetch_add ((AI), (V), __ATOMIC_ACQ_REL)
#define hb_atomic_int_impl_set_relaxed(AI, V) __atomic_store_n ((AI), (V), __ATOMIC_RELAXED)
#define hb_atomic_int_impl_set_relaxed(AI, V) __atomic_store_n ((AI), (V), __ATOMIC_RELAXED)
#define hb_atomic_int_impl_get_relaxed(AI) __atomic_load_n ((AI), __ATOMIC_RELAXED)
#define hb_atomic_int_impl_get_relaxed(AI) __atomic_load_n ((AI), __ATOMIC_RELAXED)
...
@@ -70,7 +74,6 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
...
@@ -70,7 +74,6 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
#include <atomic>
#include <atomic>
typedef
int
hb_atomic_int_impl_t
;
#define hb_atomic_int_impl_add(AI, V) (reinterpret_cast<std::atomic<int> *> (AI)->fetch_add ((V), std::memory_order_acq_rel))
#define hb_atomic_int_impl_add(AI, V) (reinterpret_cast<std::atomic<int> *> (AI)->fetch_add ((V), std::memory_order_acq_rel))
#define hb_atomic_int_impl_set_relaxed(AI, V) (reinterpret_cast<std::atomic<int> *> (AI)->store ((V), std::memory_order_relaxed))
#define hb_atomic_int_impl_set_relaxed(AI, V) (reinterpret_cast<std::atomic<int> *> (AI)->store ((V), std::memory_order_relaxed))
#define hb_atomic_int_impl_get_relaxed(AI) (reinterpret_cast<std::atomic<int> *> (AI)->load (std::memory_order_relaxed))
#define hb_atomic_int_impl_get_relaxed(AI) (reinterpret_cast<std::atomic<int> *> (AI)->load (std::memory_order_relaxed))
...
@@ -101,7 +104,6 @@ static inline void _hb_memory_barrier (void)
...
@@ -101,7 +104,6 @@ static inline void _hb_memory_barrier (void)
}
}
#define _hb_memory_barrier() _hb_memory_barrier ()
#define _hb_memory_barrier() _hb_memory_barrier ()
typedef
int
hb_atomic_int_impl_t
;
#define hb_atomic_int_impl_add(AI, V) InterlockedExchangeAdd ((unsigned *) (AI), (V))
#define hb_atomic_int_impl_add(AI, V) InterlockedExchangeAdd ((unsigned *) (AI), (V))
#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 ((void **) (P), (void *) (N), (void *) (O)) == (void *) (O))
...
@@ -111,7 +113,6 @@ typedef int hb_atomic_int_impl_t;
...
@@ -111,7 +113,6 @@ typedef int hb_atomic_int_impl_t;
#define _hb_memory_barrier() __sync_synchronize ()
#define _hb_memory_barrier() __sync_synchronize ()
typedef
int
hb_atomic_int_impl_t
;
#define hb_atomic_int_impl_add(AI, V) __sync_fetch_and_add ((AI), (V))
#define hb_atomic_int_impl_add(AI, V) __sync_fetch_and_add ((AI), (V))
#define hb_atomic_ptr_impl_cmpexch(P,O,N) __sync_bool_compare_and_swap ((P), (O), (N))
#define hb_atomic_ptr_impl_cmpexch(P,O,N) __sync_bool_compare_and_swap ((P), (O), (N))
...
@@ -126,8 +127,6 @@ typedef int hb_atomic_int_impl_t;
...
@@ -126,8 +127,6 @@ typedef int hb_atomic_int_impl_t;
#define _hb_memory_w_barrier() __machine_w_barrier ()
#define _hb_memory_w_barrier() __machine_w_barrier ()
#define _hb_memory_barrier() __machine_rw_barrier ()
#define _hb_memory_barrier() __machine_rw_barrier ()
typedef
int
hb_atomic_int_impl_t
;
static
inline
int
_hb_fetch_and_add
(
hb_atomic_int_impl_t
*
AI
,
int
V
)
static
inline
int
_hb_fetch_and_add
(
hb_atomic_int_impl_t
*
AI
,
int
V
)
{
{
_hb_memory_w_barrier
();
_hb_memory_w_barrier
();
...
@@ -159,7 +158,6 @@ static inline bool _hb_compare_and_swap_ptr (const void **P, const void *O, cons
...
@@ -159,7 +158,6 @@ static inline bool _hb_compare_and_swap_ptr (const void **P, const void *O, cons
#define _hb_memory_barrier() OSMemoryBarrier ()
#define _hb_memory_barrier() OSMemoryBarrier ()
typedef
int
hb_atomic_int_impl_t
;
#define hb_atomic_int_impl_add(AI, V) (OSAtomicAdd32Barrier ((V), (AI)) - (V))
#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)
#if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 || __IPHONE_VERSION_MIN_REQUIRED >= 20100)
...
@@ -179,8 +177,6 @@ typedef int hb_atomic_int_impl_t;
...
@@ -179,8 +177,6 @@ typedef int hb_atomic_int_impl_t;
#define _hb_memory_barrier() __lwsync ()
#define _hb_memory_barrier() __lwsync ()
typedef
int
hb_atomic_int_impl_t
;
static
inline
int
_hb_fetch_and_add
(
hb_atomic_int_impl_t
*
AI
,
int
V
)
static
inline
int
_hb_fetch_and_add
(
hb_atomic_int_impl_t
*
AI
,
int
V
)
{
{
_hb_memory_barrier
();
_hb_memory_barrier
();
...
@@ -208,15 +204,13 @@ static_assert ((sizeof (long) == sizeof (void *)), "");
...
@@ -208,15 +204,13 @@ static_assert ((sizeof (long) == sizeof (void *)), "");
#define _hb_memory_barrier()
#define _hb_memory_barrier()
typedef
volatile
int
hb_atomic_int_impl_t
;
#define hb_atomic_int_impl_add(AI, V) ((*(AI) += (V)) - (V))
#define hb_atomic_int_impl_add(AI, V) ((*(AI) += (V)) - (V))
#define hb_atomic_ptr_impl_cmpexch(P,O,N) (* (void *
volatile *) (P) == (void *) (O) ? (* (void * volatile
*) (P) = (void *) (N), true) : false)
#define hb_atomic_ptr_impl_cmpexch(P,O,N) (* (void *
*) (P) == (void *) (O) ? (* (void *
*) (P) = (void *) (N), true) : false)
#else
/* HB_NO_MT */
#else
/* HB_NO_MT */
typedef
int
hb_atomic_int_impl_t
;
#define hb_atomic_int_impl_add(AI, V) ((*(AI) += (V)) - (V))
#define hb_atomic_int_impl_add(AI, V) ((*(AI) += (V)) - (V))
#define _hb_memory_barrier()
#define _hb_memory_barrier()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录