bool make_work(long *work, long *current, long stop){ if (*current>=stop) return false; // no work left work[0]=*current; work[1]=*current+STEP_SIZE; *current=*current+STEP_SIZE+1; if (work[1]>stop) // take care of overstepping last boundary work[1]=stop; return true; }