56,7 → 56,7 |
log(MAX_THRESH)). Since total_elements has type size_t, we get as |
upper bound for log (total_elements): |
bits per byte (CHAR_BIT) * sizeof(size_t). */ |
#define STACK_SIZE (CHAR_BIT * sizeof(size_t)) |
#define QSORT_STACK_SIZE (CHAR_BIT * sizeof(size_t)) |
#define PUSH(low, high) ((void) ((top->lo = (low)), (top->hi = (high)), ++top)) |
#define POP(low, high) ((void) (--top, (low = top->lo), (high = top->hi))) |
#define STACK_NOT_EMPTY (stack < top) |
102,7 → 102,7 |
{ |
char *lo = base_ptr; |
char *hi = &lo[size * (total_elems - 1)]; |
stack_node stack[STACK_SIZE]; |
stack_node stack[QSORT_STACK_SIZE]; |
stack_node *top = stack + 1; |
|
while (STACK_NOT_EMPTY) |
199,7 → 199,6 |
of the array to sort, and END_PTR points at the very last element in |
the array (*not* one beyond it!). */ |
|
#define min(x, y) ((x) < (y) ? (x) : (y)) |
|
{ |
char *const end_ptr = &base_ptr[size * (total_elems - 1)]; |