31#ifndef _GLIBCXX_PARALLEL_EQUALLY_SPLIT_H 
   32#define _GLIBCXX_PARALLEL_EQUALLY_SPLIT_H 1 
   46  template<
typename _DifferenceType, 
typename _OutputIterator>
 
   51      _DifferenceType __chunk_length = __n / __num_threads;
 
   52      _DifferenceType __num_longer_chunks = __n % __num_threads;
 
   53      _DifferenceType __pos = 0;
 
   57          __pos += ((__i < __num_longer_chunks)
 
   58                    ? (__chunk_length + 1) : __chunk_length);
 
   73  template<
typename _DifferenceType>
 
   79      _DifferenceType __chunk_length = __n / __num_threads;
 
   80      _DifferenceType __num_longer_chunks = __n % __num_threads;
 
   81      if (__thread_no < __num_longer_chunks)
 
   82        return __thread_no * (__chunk_length + 1);
 
   84        return __num_longer_chunks * (__chunk_length + 1)
 
   85          + (__thread_no - __num_longer_chunks) * __chunk_length;
 
GNU parallel code for public use.
uint16_t _ThreadIndex
Unsigned integer to index a thread number. The maximum thread number (for each processor) must fit in...
_DifferenceType __equally_split_point(_DifferenceType __n, _ThreadIndex __num_threads, _ThreadIndex __thread_no)
function to split a sequence into parts of almost equal size.
_OutputIterator __equally_split(_DifferenceType __n, _ThreadIndex __num_threads, _OutputIterator __s)
function to split a sequence into parts of almost equal size.