Sebastian Lackner : vcomp: Implement _vcomp_for_static_simple_init and _vcomp_for_static_end.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jul 20 14:20:49 CDT 2015


Module: wine
Branch: master
Commit: 6f34d0fe1f67632cc24b304a536a9790e9365ec0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6f34d0fe1f67632cc24b304a536a9790e9365ec0

Author: Sebastian Lackner <sebastian at fds-team.de>
Date:   Mon Jul 20 05:16:47 2015 +0200

vcomp: Implement _vcomp_for_static_simple_init and _vcomp_for_static_end.

---

 dlls/vcomp/main.c           | 57 +++++++++++++++++++++++++++++++++++++++++++++
 dlls/vcomp/vcomp.spec       |  4 ++--
 dlls/vcomp100/vcomp100.spec |  4 ++--
 dlls/vcomp90/vcomp90.spec   |  4 ++--
 4 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c
index d76df1e..c06625a 100644
--- a/dlls/vcomp/main.c
+++ b/dlls/vcomp/main.c
@@ -361,6 +361,63 @@ int CDECL _vcomp_sections_next(void)
     return i;
 }
 
+void CDECL _vcomp_for_static_simple_init(unsigned int first, unsigned int last, int step,
+                                         BOOL increment, unsigned int *begin, unsigned int *end)
+{
+    unsigned int iterations, per_thread, remaining;
+    struct vcomp_thread_data *thread_data = vcomp_init_thread_data();
+    struct vcomp_team_data *team_data = thread_data->team;
+    int num_threads = team_data ? team_data->num_threads : 1;
+    int thread_num = thread_data->thread_num;
+
+    TRACE("(%u, %u, %d, %u, %p, %p)\n", first, last, step, increment, begin, end);
+
+    if (num_threads == 1)
+    {
+        *begin = first;
+        *end   = last;
+        return;
+    }
+
+    if (step <= 0)
+    {
+        *begin = 0;
+        *end   = increment ? -1 : 1;
+        return;
+    }
+
+    if (increment)
+        iterations = 1 + (last - first) / step;
+    else
+    {
+        iterations = 1 + (first - last) / step;
+        step *= -1;
+    }
+
+    per_thread = iterations / num_threads;
+    remaining  = iterations - per_thread * num_threads;
+
+    if (thread_num < remaining)
+        per_thread++;
+    else if (per_thread)
+        first += remaining * step;
+    else
+    {
+        *begin = first;
+        *end   = first - step;
+        return;
+    }
+
+    *begin = first + per_thread * thread_num * step;
+    *end   = *begin + (per_thread - 1) * step;
+}
+
+void CDECL _vcomp_for_static_end(void)
+{
+    TRACE("()\n");
+    /* nothing to do here */
+}
+
 int CDECL omp_in_parallel(void)
 {
     TRACE("()\n");
diff --git a/dlls/vcomp/vcomp.spec b/dlls/vcomp/vcomp.spec
index 5a5b114..d6b8bf5 100644
--- a/dlls/vcomp/vcomp.spec
+++ b/dlls/vcomp/vcomp.spec
@@ -59,10 +59,10 @@
 @ stub _vcomp_for_dynamic_init_i8
 @ stub _vcomp_for_dynamic_next
 @ stub _vcomp_for_dynamic_next_i8
-@ stub _vcomp_for_static_end
+@ cdecl _vcomp_for_static_end()
 @ stub _vcomp_for_static_init
 @ stub _vcomp_for_static_init_i8
-@ stub _vcomp_for_static_simple_init
+@ cdecl _vcomp_for_static_simple_init(long long long long ptr ptr)
 @ stub _vcomp_for_static_simple_init_i8
 @ varargs _vcomp_fork(long long ptr)
 @ stub _vcomp_get_thread_num
diff --git a/dlls/vcomp100/vcomp100.spec b/dlls/vcomp100/vcomp100.spec
index debc5ff..a6933c8 100644
--- a/dlls/vcomp100/vcomp100.spec
+++ b/dlls/vcomp100/vcomp100.spec
@@ -59,10 +59,10 @@
 @ stub _vcomp_for_dynamic_init_i8
 @ stub _vcomp_for_dynamic_next
 @ stub _vcomp_for_dynamic_next_i8
-@ stub _vcomp_for_static_end
+@ cdecl _vcomp_for_static_end() vcomp._vcomp_for_static_end
 @ stub _vcomp_for_static_init
 @ stub _vcomp_for_static_init_i8
-@ stub _vcomp_for_static_simple_init
+@ cdecl _vcomp_for_static_simple_init(long long long long ptr ptr) vcomp._vcomp_for_static_simple_init
 @ stub _vcomp_for_static_simple_init_i8
 @ varargs _vcomp_fork(long long ptr) vcomp._vcomp_fork
 @ stub _vcomp_get_thread_num
diff --git a/dlls/vcomp90/vcomp90.spec b/dlls/vcomp90/vcomp90.spec
index debc5ff..a6933c8 100644
--- a/dlls/vcomp90/vcomp90.spec
+++ b/dlls/vcomp90/vcomp90.spec
@@ -59,10 +59,10 @@
 @ stub _vcomp_for_dynamic_init_i8
 @ stub _vcomp_for_dynamic_next
 @ stub _vcomp_for_dynamic_next_i8
-@ stub _vcomp_for_static_end
+@ cdecl _vcomp_for_static_end() vcomp._vcomp_for_static_end
 @ stub _vcomp_for_static_init
 @ stub _vcomp_for_static_init_i8
-@ stub _vcomp_for_static_simple_init
+@ cdecl _vcomp_for_static_simple_init(long long long long ptr ptr) vcomp._vcomp_for_static_simple_init
 @ stub _vcomp_for_static_simple_init_i8
 @ varargs _vcomp_fork(long long ptr) vcomp._vcomp_fork
 @ stub _vcomp_get_thread_num




More information about the wine-cvs mailing list