/* * size *must* be less than i->maxsize */ void sort_setup(sort_info *i, Int16_t *vector, long *abspos, long size, long sortlo, long sorthi) { if (i->sortbegin != -1) sort_unsortall(i); i->vector = vector; i->size = size; i->abspos = abspos; i->lo = min(size, max(sortlo - *abspos, 0)); i->hi = max(0, min(sorthi - *abspos, size)); }
void sort_setup(sort_info_t *i, int16_t *vector, long int *abspos, long int size, long int sortlo, long int sorthi) { /* Reset the index if it has already been built. */ if (i->sortbegin!=-1) sort_unsortall(i); i->vector=vector; i->size=size; i->abspos=abspos; /* Convert the absolute (sortlo, sorthi) to offsets within the vector. * Note that the index will not be built until sort_getmatch() is called. * Here we're simply hanging on to the range to index until then. */ i->lo = min(size, max(sortlo - *abspos, 0)); i->hi = max(0, min(sorthi - *abspos, size)); }