Lines Matching refs:stack
295 static int CHECK_INVARIANT(TIM_SORT_RUN_T *stack, const int stack_curr)
301 const int64_t A1 = stack[stack_curr - 2].length;
302 const int64_t B1 = stack[stack_curr - 1].length;
306 A = stack[stack_curr - 3].length;
307 B = stack[stack_curr - 2].length;
308 C = stack[stack_curr - 1].length;
334 static void TIM_SORT_MERGE(SORT_TYPE *dst, const TIM_SORT_RUN_T *stack, const int stack_curr, TEMP_STORAGE_T *store)
336 const int64_t A = stack[stack_curr - 2].length;
337 const int64_t B = stack[stack_curr - 1].length;
338 const int64_t curr = stack[stack_curr - 2].start;
393 static int TIM_SORT_COLLAPSE(SORT_TYPE *dst, TIM_SORT_RUN_T *stack, int stack_curr, TEMP_STORAGE_T *store, const size_t size)
399 /* if the stack only has one thing on it, we are done with the collapse */
405 if ((stack_curr == 2) && (stack[0].length + stack[1].length == size)) {
406 TIM_SORT_MERGE(dst, stack, stack_curr, store);
407 stack[0].length += stack[1].length;
411 /* check if the invariant is off for a stack of 2 elements */
412 else if ((stack_curr == 2) && (stack[0].length <= stack[1].length)) {
413 TIM_SORT_MERGE(dst, stack, stack_curr, store);
414 stack[0].length += stack[1].length;
421 B = stack[stack_curr - 3].length;
422 C = stack[stack_curr - 2].length;
423 D = stack[stack_curr - 1].length;
426 A = stack[stack_curr - 4].length;
443 TIM_SORT_MERGE(dst, stack, stack_curr - 1, store);
444 stack[stack_curr - 3].length += stack[stack_curr - 2].length;
445 stack[stack_curr - 2] = stack[stack_curr - 1];
449 TIM_SORT_MERGE(dst, stack, stack_curr, store);
450 stack[stack_curr - 2].length += stack[stack_curr - 1].length;