diff options
| author | phil <phil@NetBSD.org> | 1996-12-17 18:55:08 +0000 |
|---|---|---|
| committer | phil <phil@NetBSD.org> | 1996-12-17 18:55:08 +0000 |
| commit | 1496ef1851bd95279a6c0eae83218e7512c414c8 (patch) | |
| tree | 202eeb07e282ee89038c2cbeb94f56ace5696803 /gnu/lib/libg++/include | |
| parent | 1460fbef53f4978617338a8c46f435a648572ca9 (diff) | |
Import of libg++ 2.7.2.
Diffstat (limited to 'gnu/lib/libg++/include')
| -rw-r--r-- | gnu/lib/libg++/include/gen/VHMap.ccP | 2 | ||||
| -rw-r--r-- | gnu/lib/libg++/include/gen/Vec.ccP | 18 |
2 files changed, 14 insertions, 6 deletions
diff --git a/gnu/lib/libg++/include/gen/VHMap.ccP b/gnu/lib/libg++/include/gen/VHMap.ccP index d3f2fcfc835..a24be1e5bfa 100644 --- a/gnu/lib/libg++/include/gen/VHMap.ccP +++ b/gnu/lib/libg++/include/gen/VHMap.ccP @@ -169,7 +169,7 @@ void <T><C>VHMap::resize(unsigned int newsize) (*this)[oldtab[i]] = oldcont[i]; delete [] oldtab; delete [] oldcont; - delete oldstatus; + delete [] oldstatus; } Pix <T><C>VHMap::first() diff --git a/gnu/lib/libg++/include/gen/Vec.ccP b/gnu/lib/libg++/include/gen/Vec.ccP index ac3825b0b8d..d03e0bba4c4 100644 --- a/gnu/lib/libg++/include/gen/Vec.ccP +++ b/gnu/lib/libg++/include/gen/Vec.ccP @@ -332,9 +332,9 @@ static int gsort (<T> *base_ptr, int total_elems, <T>Comparator cmp) <T> *left_ptr; <T> *right_ptr; stack_node stack[STACK_SIZE]; /* Largest size needed for 32-bit int!!! */ - stack_node *top = stack + 1; + stack_node *top = stack; - while (STACK_NOT_EMPTY) + for (;;) { { <T> *pivot = &pivot_buffer; @@ -362,7 +362,10 @@ static int gsort (<T> *base_ptr, int total_elems, <T>Comparator cmp) /* Here's the famous ``collapse the walls'' section of quicksort. Gotta like those tight inner loops! They are the main reason - that this algorithm runs much faster than others. */ + that this algorithm runs much faster than others. + + [Yeah, but there is a function call in the inner loop, + which makes the speed claim rather dubious. --Per Bothner] */ do { while ((*cmp) (*left_ptr, *pivot) < 0) @@ -395,8 +398,13 @@ static int gsort (<T> *base_ptr, int total_elems, <T>Comparator cmp) if ((right_ptr - lo) <= max_thresh) { - if ((hi - left_ptr) <= max_thresh) /* Ignore both small partitions. */ - POP (lo, hi); + if ((hi - left_ptr) <= max_thresh) + { /* Ignore both small partitions. */ + if (STACK_NOT_EMPTY) + POP (lo, hi); + else + break; /* No pending partitions - we're done. */ + } else /* Ignore small left partition. */ lo = left_ptr; } |
