Sebastian Lackner : vcomp: Implement _vcomp_for_static_init.

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


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

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

vcomp: Implement _vcomp_for_static_init.

---

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

diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c
index c06625a..ae5623b 100644
--- a/dlls/vcomp/main.c
+++ b/dlls/vcomp/main.c
@@ -412,6 +412,69 @@ void CDECL _vcomp_for_static_simple_init(unsigned int first, unsigned int last,
     *end   = *begin + (per_thread - 1) * step;
 }
 
+void CDECL _vcomp_for_static_init(int first, int last, int step, int chunksize, unsigned int *loops,
+                                  int *begin, int *end, int *next, int *lastchunk)
+{
+    unsigned int iterations, num_chunks, 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("(%d, %d, %d, %d, %p, %p, %p, %p, %p)\n",
+          first, last, step, chunksize, loops, begin, end, next, lastchunk);
+
+    if (num_threads == 1 && chunksize != 1)
+    {
+        *loops      = 1;
+        *begin      = first;
+        *end        = last;
+        *next       = 0;
+        *lastchunk  = first;
+        return;
+    }
+
+    if (first == last)
+    {
+        *loops = !thread_num;
+        if (!thread_num)
+        {
+            *begin      = first;
+            *end        = last;
+            *next       = 0;
+            *lastchunk  = first;
+        }
+        return;
+    }
+
+    if (step <= 0)
+    {
+        *loops = 0;
+        return;
+    }
+
+    if (first < last)
+        iterations = 1 + (last - first) / step;
+    else
+    {
+        iterations = 1 + (first - last) / step;
+        step *= -1;
+    }
+
+    if (chunksize < 1)
+        chunksize = 1;
+
+    num_chunks  = ((DWORD64)iterations + chunksize - 1) / chunksize;
+    per_thread  = num_chunks / num_threads;
+    remaining   = num_chunks - per_thread * num_threads;
+
+    *loops      = per_thread + (thread_num < remaining);
+    *begin      = first + thread_num * chunksize * step;
+    *end        = *begin + (chunksize - 1) * step;
+    *next       = chunksize * num_threads * step;
+    *lastchunk  = first + (num_chunks - 1) * chunksize * step;
+}
+
 void CDECL _vcomp_for_static_end(void)
 {
     TRACE("()\n");
diff --git a/dlls/vcomp/vcomp.spec b/dlls/vcomp/vcomp.spec
index d6b8bf5..7083ce4 100644
--- a/dlls/vcomp/vcomp.spec
+++ b/dlls/vcomp/vcomp.spec
@@ -60,7 +60,7 @@
 @ stub _vcomp_for_dynamic_next
 @ stub _vcomp_for_dynamic_next_i8
 @ cdecl _vcomp_for_static_end()
-@ stub _vcomp_for_static_init
+@ cdecl _vcomp_for_static_init(long long long long ptr ptr ptr ptr ptr)
 @ stub _vcomp_for_static_init_i8
 @ cdecl _vcomp_for_static_simple_init(long long long long ptr ptr)
 @ stub _vcomp_for_static_simple_init_i8
diff --git a/dlls/vcomp100/vcomp100.spec b/dlls/vcomp100/vcomp100.spec
index a6933c8..56c7ae3 100644
--- a/dlls/vcomp100/vcomp100.spec
+++ b/dlls/vcomp100/vcomp100.spec
@@ -60,7 +60,7 @@
 @ stub _vcomp_for_dynamic_next
 @ stub _vcomp_for_dynamic_next_i8
 @ cdecl _vcomp_for_static_end() vcomp._vcomp_for_static_end
-@ stub _vcomp_for_static_init
+@ cdecl _vcomp_for_static_init(long long long long ptr ptr ptr ptr ptr) vcomp._vcomp_for_static_init
 @ stub _vcomp_for_static_init_i8
 @ 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
diff --git a/dlls/vcomp90/vcomp90.spec b/dlls/vcomp90/vcomp90.spec
index a6933c8..56c7ae3 100644
--- a/dlls/vcomp90/vcomp90.spec
+++ b/dlls/vcomp90/vcomp90.spec
@@ -60,7 +60,7 @@
 @ stub _vcomp_for_dynamic_next
 @ stub _vcomp_for_dynamic_next_i8
 @ cdecl _vcomp_for_static_end() vcomp._vcomp_for_static_end
-@ stub _vcomp_for_static_init
+@ cdecl _vcomp_for_static_init(long long long long ptr ptr ptr ptr ptr) vcomp._vcomp_for_static_init
 @ stub _vcomp_for_static_init_i8
 @ 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




More information about the wine-cvs mailing list