wine-staging/patches/vcomp-Functions/0005-vcomp-Implement-atomic-double-functions.patch

109 lines
3.0 KiB
Diff

From 932eec0d4c46b47bace34f1bcee0483be0b450e0 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 26 Jul 2015 02:01:17 +0200
Subject: vcomp: Implement atomic double functions.
---
dlls/vcomp/main.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
dlls/vcomp/vcomp.spec | 8 ++++----
2 files changed, 48 insertions(+), 4 deletions(-)
diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c
index 92c8eaf..301370c 100644
--- a/dlls/vcomp/main.c
+++ b/dlls/vcomp/main.c
@@ -330,6 +330,50 @@ void CDECL _vcomp_atomic_sub_r4(float *dest, float val)
while (interlocked_cmpxchg((int *)dest, new, old) != old);
}
+void CDECL _vcomp_atomic_add_r8(double *dest, double val)
+{
+ LONG64 old, new;
+ do
+ {
+ old = *(LONG64 *)dest;
+ *(double *)&new = *(double *)&old + val;
+ }
+ while (interlocked_cmpxchg64((LONG64 *)dest, new, old) != old);
+}
+
+void CDECL _vcomp_atomic_div_r8(double *dest, double val)
+{
+ LONG64 old, new;
+ do
+ {
+ old = *(LONG64 *)dest;
+ *(double *)&new = *(double *)&old / val;
+ }
+ while (interlocked_cmpxchg64((LONG64 *)dest, new, old) != old);
+}
+
+void CDECL _vcomp_atomic_mul_r8(double *dest, double val)
+{
+ LONG64 old, new;
+ do
+ {
+ old = *(LONG64 *)dest;
+ *(double *)&new = *(double *)&old * val;
+ }
+ while (interlocked_cmpxchg64((LONG64 *)dest, new, old) != old);
+}
+
+void CDECL _vcomp_atomic_sub_r8(double *dest, double val)
+{
+ LONG64 old, new;
+ do
+ {
+ old = *(LONG64 *)dest;
+ *(double *)&new = *(double *)&old - val;
+ }
+ while (interlocked_cmpxchg64((LONG64 *)dest, new, old) != old);
+}
+
int CDECL omp_get_dynamic(void)
{
TRACE("stub\n");
diff --git a/dlls/vcomp/vcomp.spec b/dlls/vcomp/vcomp.spec
index bc963cb..3a709df 100644
--- a/dlls/vcomp/vcomp.spec
+++ b/dlls/vcomp/vcomp.spec
@@ -3,7 +3,7 @@
@ cdecl _vcomp_atomic_add_i4(ptr long)
@ stub _vcomp_atomic_add_i8
@ cdecl _vcomp_atomic_add_r4(ptr float)
-@ stub _vcomp_atomic_add_r8
+@ cdecl _vcomp_atomic_add_r8(ptr double)
@ stub _vcomp_atomic_and_i1
@ stub _vcomp_atomic_and_i2
@ cdecl _vcomp_atomic_and_i4(ptr long)
@@ -13,7 +13,7 @@
@ cdecl _vcomp_atomic_div_i4(ptr long)
@ stub _vcomp_atomic_div_i8
@ cdecl _vcomp_atomic_div_r4(ptr float)
-@ stub _vcomp_atomic_div_r8
+@ cdecl _vcomp_atomic_div_r8(ptr double)
@ stub _vcomp_atomic_div_ui1
@ stub _vcomp_atomic_div_ui2
@ cdecl _vcomp_atomic_div_ui4(ptr long)
@@ -23,7 +23,7 @@
@ cdecl _vcomp_atomic_mul_i4(ptr long)
@ stub _vcomp_atomic_mul_i8
@ cdecl _vcomp_atomic_mul_r4(ptr float)
-@ stub _vcomp_atomic_mul_r8
+@ cdecl _vcomp_atomic_mul_r8(ptr double)
@ stub _vcomp_atomic_or_i1
@ stub _vcomp_atomic_or_i2
@ cdecl _vcomp_atomic_or_i4(ptr long)
@@ -45,7 +45,7 @@
@ cdecl _vcomp_atomic_sub_i4(ptr long)
@ stub _vcomp_atomic_sub_i8
@ cdecl _vcomp_atomic_sub_r4(ptr float)
-@ stub _vcomp_atomic_sub_r8
+@ cdecl _vcomp_atomic_sub_r8(ptr double)
@ stub _vcomp_atomic_xor_i1
@ stub _vcomp_atomic_xor_i2
@ cdecl _vcomp_atomic_xor_i4(ptr long)
--
2.4.5