fixed bug in array.insert(index,array)
This commit is contained in:
@ -493,16 +493,16 @@ template<typename T> int amsarray<T>::insert(amsarray_size_t ind, const amsarray
|
||||
else if(ind<=this->length)
|
||||
{
|
||||
oldlen = this->length;
|
||||
res = this->resize_insert(this->length + other.length);
|
||||
res = this->resize_insert(oldlen + other.length);
|
||||
if(res==amsarray_success)
|
||||
{
|
||||
//for now, do things single threaded.
|
||||
//to do things multithreaded, I'd need another buffer
|
||||
if(this->data!=NULL && other.data!=NULL)
|
||||
{
|
||||
for(I=oldlen;I>=ind+other.length;I--)
|
||||
for(I=oldlen+other.length-1;I>=ind+other.length;I--)
|
||||
{
|
||||
this->data[I] = std::move(this->data[I-1]);
|
||||
this->data[I] = std::move(this->data[I-other.length]);
|
||||
}
|
||||
for(I=ind;I<ind+other.length;I++)
|
||||
{
|
||||
|
||||
@ -300,6 +300,7 @@ template<typename T> int amsarray_quicksort_threaded(
|
||||
rangeptr = 0;
|
||||
ranges.append(ams::pair<amsarray_size_t,amsarray_size_t>(0,array->length));
|
||||
|
||||
|
||||
while(rangeptr<ranges.length)
|
||||
{
|
||||
//spawn up to the maximum number of threads
|
||||
@ -340,6 +341,7 @@ template<typename T> int amsarray_quicksort_threaded(
|
||||
}
|
||||
//rangeptr++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user