vcomp: Implement _vcomp_for_static_simple_init and _vcomp_for_static_end.

This commit is contained in:
Sebastian Lackner 2015-07-20 05:16:47 +02:00 committed by Alexandre Julliard
parent bc10d127b4
commit 6f34d0fe1f
4 changed files with 63 additions and 6 deletions

View File

@ -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");

View File

@ -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

View File

@ -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

View File

@ -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