Lines Matching refs:budget
202 trbudget_init(trbudget_t *budget, saidx_t chance, saidx_t incval) { in trbudget_init() argument
203 budget->chance = chance; in trbudget_init()
204 budget->remain = budget->incval = incval; in trbudget_init()
209 trbudget_check(trbudget_t *budget, saidx_t size) { in trbudget_check() argument
210 if(size <= budget->remain) { budget->remain -= size; return 1; } in trbudget_check()
211 if(budget->chance == 0) { budget->count += size; return 0; } in trbudget_check()
212 budget->remain += budget->incval - size; in trbudget_check()
213 budget->chance -= 1; in trbudget_check()
329 trbudget_t *budget) { in tr_introsort() argument
402 if(trbudget_check(budget, a - first)) { in tr_introsort()
459 if((1 < (b - a)) && (trbudget_check(budget, b - a))) { in tr_introsort()
536 if(trbudget_check(budget, last - first)) { in tr_introsort()
558 trbudget_t budget; in trsort() local
561 trbudget_init(&budget, tr_ilg(n) * 2 / 3, n); in trsort()
573 budget.count = 0; in trsort()
574 tr_introsort(ISA, ISAd, SA, first, last, &budget); in trsort()
575 if(budget.count != 0) { unsorted += budget.count; } in trsort()