Fix timsort to use updated vec::reserve
This commit is contained in:
parent
cef7763649
commit
f98f00f7f6
@ -219,8 +219,8 @@ fn binarysort<T: Ord>(array: &[mut T], start: uint) {
|
|||||||
|
|
||||||
if start == 0 { start += 1; }
|
if start == 0 { start += 1; }
|
||||||
|
|
||||||
let mut pivot = ~[mut];
|
let mut pivot = ~[];
|
||||||
vec::reserve(pivot, 1);
|
vec::reserve(&mut pivot, 1);
|
||||||
unsafe { vec::raw::set_len(pivot, 1); };
|
unsafe { vec::raw::set_len(pivot, 1); };
|
||||||
|
|
||||||
while start < size {
|
while start < size {
|
||||||
@ -409,7 +409,7 @@ struct MergeState<T> {
|
|||||||
|
|
||||||
fn MergeState<T>() -> MergeState<T> {
|
fn MergeState<T>() -> MergeState<T> {
|
||||||
let mut tmp = ~[];
|
let mut tmp = ~[];
|
||||||
vec::reserve(tmp, INITIAL_TMP_STORAGE);
|
vec::reserve(&mut tmp, INITIAL_TMP_STORAGE);
|
||||||
MergeState {
|
MergeState {
|
||||||
minGallop: MIN_GALLOP,
|
minGallop: MIN_GALLOP,
|
||||||
tmp: tmp,
|
tmp: tmp,
|
||||||
@ -467,7 +467,7 @@ fn mergeAt(n: uint, array: &[mut T]) {
|
|||||||
fn mergeLo(array: &[mut T], base1: uint, len1: uint, base2: uint, len2: uint) {
|
fn mergeLo(array: &[mut T], base1: uint, len1: uint, base2: uint, len2: uint) {
|
||||||
assert len1 != 0 && len2 != 0 && base1+len1 == base2;
|
assert len1 != 0 && len2 != 0 && base1+len1 == base2;
|
||||||
|
|
||||||
vec::reserve(self.tmp, len1);
|
vec::reserve(&mut self.tmp, len1);
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
vec::raw::set_len(self.tmp, len1);
|
vec::raw::set_len(self.tmp, len1);
|
||||||
@ -587,7 +587,7 @@ fn mergeLo(array: &[mut T], base1: uint, len1: uint, base2: uint, len2: uint) {
|
|||||||
fn mergeHi(array: &[mut T], base1: uint, len1: uint, base2: uint, len2: uint) {
|
fn mergeHi(array: &[mut T], base1: uint, len1: uint, base2: uint, len2: uint) {
|
||||||
assert len1 != 1 && len2 != 0 && base1 + len1 == base2;
|
assert len1 != 1 && len2 != 0 && base1 + len1 == base2;
|
||||||
|
|
||||||
vec::reserve(self.tmp, len2);
|
vec::reserve(&mut self.tmp, len2);
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
vec::raw::set_len(self.tmp, len2);
|
vec::raw::set_len(self.tmp, len2);
|
||||||
|
Loading…
Reference in New Issue
Block a user