fn thread_range(&self, num_items: i64, tid: i64) -> Option<Range<i64>> {
        let mut thread_elements = num_items / self.threads;
        if thread_elements == 0 && tid != 0 {
            return None;
        }

        if thread_elements == 0 {
            // we are on thread 0.
            thread_elements = num_items;
        } else {
            // Adjust so we round up.
            thread_elements = (num_items / self.threads + ((num_items % self.threads != 0) as i64)) as i64;
        }

        let thread_start = thread_elements * tid;
        let thread_end = std::cmp::min(num_items, thread_elements * (tid + 1));
        Some(thread_start..thread_end)
    }
/// Returns a range that this thread should process.
///
/// If this method returns `None`, the thread has no elements to process and should terminate.
Returns a range that this thread should process.
If this method returns `None`, the thread has no elements to process and should terminate.
Returns a range that this thread should process . If this method returns ` None ` the thread has no elements to process and should terminate .
fn thread_range(&self, num_items: i64, tid: i64) -> Option<Range<i64>> {
        let mut thread_elements = num_items / self.threads;
        if thread_elements == 0 && tid != 0 {
            return None;
        }
        if thread_elements == 0 {
            // we are on thread 0.
            thread_elements = num_items;
        } else {
            // Adjust so we round up.
            thread_elements = (num_items / self.threads + ((num_items % self.threads != 0) as i64)) as i64;
        }
        let thread_start = thread_elements * tid;
        let thread_end = std::cmp::min(num_items, thread_elements * (tid + 1));
        Some(thread_start..thread_end)
    }
fn thread_range ( & self , num_items : i64 , tid : i64 ) -> Option < Range < i64 > > { let mut thread_elements = num_items / self . threads ; if thread_elements == 0 && tid != 0 { return None ; } if thread_elements == 0 { // we are on thread 0. thread_elements = num_items ; } else { // Adjust so we round up. thread_elements = ( num_items / self . threads + ( ( num_items % self . threads != 0 ) as i64 ) ) as i64 ; } let thread_start = thread_elements * tid ; let thread_end = std :: cmp :: min ( num_items , thread_elements * ( tid + 1 ) ) ; Some ( thread_start .. thread_end ) }
Returns a range that this thread should process.
Returns a range that this thread should process .
&self
num_items
i64
tid
i64