• Home
  • Raw
  • Download

Lines Matching refs:first

168                  saidx_t *first, saidx_t *last, saidx_t depth) {  in ss_insertionsort()  argument
173 for(i = last - 2; first <= i; --i) { in ss_insertionsort()
263 ss_pivot(const sauchar_t *Td, const saidx_t *PA, saidx_t *first, saidx_t *last) { in ss_pivot() argument
267 t = last - first; in ss_pivot()
268 middle = first + t / 2; in ss_pivot()
272 return ss_median3(Td, PA, first, middle, last - 1); in ss_pivot()
275 return ss_median5(Td, PA, first, first + t, middle, last - 1 - t, last - 1); in ss_pivot()
279 first = ss_median3(Td, PA, first, first + t, first + (t << 1)); in ss_pivot()
282 return ss_median3(Td, PA, first, middle, last); in ss_pivot()
292 saidx_t *first, saidx_t *last, saidx_t depth) { in ss_partition() argument
295 for(a = first - 1, b = last;;) { in ss_partition()
303 if(first < a) { *first = ~*first; } in ss_partition()
311 saidx_t *first, saidx_t *last, in ss_mintrosort() argument
322 for(ssize = 0, limit = ss_ilg(last - first);;) { in ss_mintrosort()
324 if((last - first) <= SS_INSERTIONSORT_THRESHOLD) { in ss_mintrosort()
326 if(1 < (last - first)) { ss_insertionsort(T, PA, first, last, depth); } in ss_mintrosort()
328 STACK_POP(first, last, depth, limit); in ss_mintrosort()
333 if(limit-- == 0) { ss_heapsort(Td, PA, first, last - first); } in ss_mintrosort()
335 for(a = first + 1, v = Td[PA[*first]]; a < last; ++a) { in ss_mintrosort()
337 if(1 < (a - first)) { break; } in ss_mintrosort()
339 first = a; in ss_mintrosort()
342 if(Td[PA[*first] - 1] < v) { in ss_mintrosort()
343 first = ss_partition(PA, first, a, depth); in ss_mintrosort()
345 if((a - first) <= (last - a)) { in ss_mintrosort()
346 if(1 < (a - first)) { in ss_mintrosort()
348 last = a, depth += 1, limit = ss_ilg(a - first); in ss_mintrosort()
350 first = a, limit = -1; in ss_mintrosort()
354 STACK_PUSH(first, a, depth + 1, ss_ilg(a - first)); in ss_mintrosort()
355 first = a, limit = -1; in ss_mintrosort()
357 last = a, depth += 1, limit = ss_ilg(a - first); in ss_mintrosort()
364 a = ss_pivot(Td, PA, first, last); in ss_mintrosort()
366 SWAP(*first, *a); in ss_mintrosort()
369 for(b = first; (++b < last) && ((x = Td[PA[*b]]) == v);) { } in ss_mintrosort()
394 if((s = a - first) > (t = b - a)) { s = t; } in ss_mintrosort()
395 for(e = first, f = b - s; 0 < s; --s, ++e, ++f) { SWAP(*e, *f); } in ss_mintrosort()
399 a = first + (b - a), c = last - (d - c); in ss_mintrosort()
402 if((a - first) <= (last - c)) { in ss_mintrosort()
407 } else if((a - first) <= (c - b)) { in ss_mintrosort()
413 STACK_PUSH(first, a, depth, limit); in ss_mintrosort()
414 first = b, last = c, depth += 1, limit = ss_ilg(c - b); in ss_mintrosort()
417 if((a - first) <= (c - b)) { in ss_mintrosort()
419 STACK_PUSH(first, a, depth, limit); in ss_mintrosort()
420 first = c; in ss_mintrosort()
422 STACK_PUSH(first, a, depth, limit); in ss_mintrosort()
424 first = c; in ss_mintrosort()
426 STACK_PUSH(first, a, depth, limit); in ss_mintrosort()
428 first = b, last = c, depth += 1, limit = ss_ilg(c - b); in ss_mintrosort()
433 if(Td[PA[*first] - 1] < v) { in ss_mintrosort()
434 first = ss_partition(PA, first, last, depth); in ss_mintrosort()
435 limit = ss_ilg(last - first); in ss_mintrosort()
461 ss_rotate(saidx_t *first, saidx_t *middle, saidx_t *last) { in ss_rotate() argument
464 l = middle - first, r = last - middle; in ss_rotate()
466 if(l == r) { ss_blockswap(first, middle, l); break; } in ss_rotate()
472 if(b < first) { in ss_rotate()
481 a = first, b = middle; in ss_rotate()
487 first = a + 1; in ss_rotate()
503 saidx_t *first, saidx_t *middle, saidx_t *last, in ss_inplacemerge() argument
514 for(a = first, len = middle - first, half = len >> 1, r = -1; in ss_inplacemerge()
531 if(first == middle) { break; } in ss_inplacemerge()
546 saidx_t *first, saidx_t *middle, saidx_t *last, in ss_mergeforward() argument
552 bufend = buf + (middle - first) - 1; in ss_mergeforward()
553 ss_blockswap(buf, first, middle - first); in ss_mergeforward()
555 for(t = *(a = first), b = buf, c = middle;;) { in ss_mergeforward()
596 saidx_t *first, saidx_t *middle, saidx_t *last, in ss_mergebackward() argument
624 if(c < first) { in ss_mergebackward()
638 if(c < first) { in ss_mergebackward()
655 saidx_t *first, saidx_t *middle, saidx_t *last, in ss_swapmerge() argument
677 if((first < middle) && (middle < last)) { in ss_swapmerge()
678 ss_mergebackward(T, PA, first, middle, last, buf, depth); in ss_swapmerge()
680 MERGE_CHECK(first, last, check); in ss_swapmerge()
681 STACK_POP(first, middle, last, check); in ss_swapmerge()
685 if((middle - first) <= bufsize) { in ss_swapmerge()
686 if(first < middle) { in ss_swapmerge()
687 ss_mergeforward(T, PA, first, middle, last, buf, depth); in ss_swapmerge()
689 MERGE_CHECK(first, last, check); in ss_swapmerge()
690 STACK_POP(first, middle, last, check); in ss_swapmerge()
694 for(m = 0, len = MIN(middle - first, last - middle), half = len >> 1; in ss_swapmerge()
711 if(first < lm) { for(; *--l < 0;) { } next |= 4; } in ss_swapmerge()
713 } else if(first < lm) { in ss_swapmerge()
719 if((l - first) <= (last - r)) { in ss_swapmerge()
724 STACK_PUSH(first, lm, l, (check & 3) | (next & 4)); in ss_swapmerge()
725 first = r, middle = rm, check = (next & 3) | (check & 4); in ss_swapmerge()
731 MERGE_CHECK(first, last, check); in ss_swapmerge()
732 STACK_POP(first, middle, last, check); in ss_swapmerge()
748 saidx_t *first, saidx_t *last, in sssort() argument
758 if(lastsuffix != 0) { ++first; } in sssort()
761 ss_mintrosort(T, PA, first, last, depth); in sssort()
764 (bufsize < (last - first)) && in sssort()
765 (bufsize < (limit = ss_isqrt(last - first)))) { in sssort()
771 for(a = first, i = 0; SS_BLOCKSIZE < (middle - a); a += SS_BLOCKSIZE, ++i) { in sssort()
801 ss_inplacemerge(T, PA, first, middle, last, depth); in sssort()
807 saidx_t PAi[2]; PAi[0] = PA[*(first - 1)], PAi[1] = n - 2; in sssort()
808 for(a = first, i = *(first - 1); in sssort()