RFA: delete_test1 Modifications
Jeffrey Oldham
oldham at codesourcery.com
Thu May 24 00:33:02 UTC 2001
OK to commit?
Compiling src/Utilities/tests/delete_test1.cpp showed that the vector
type `Array_t' was declared to store doubles but actually stored
integers. Also, a call to std::memmove() illegally converted vector
iterators to pointers. The alternative call to std::copy() is instead
used.
2001 May 23 Jeffrey D. Oldham <oldham at codesourcery.com>
* delete_test1.cpp (Array_t): s/vector<double>/vector<int>/
(delete_shiftup_test2): Remove "optimization" call to memmove.
Tested on sequential Linux using gcc 3.0 by compiling the program
Approved by ???you???
Thanks,
Jeffrey D. Oldham
oldham at codesourcery.com
-------------- next part --------------
Index: delete_test1.cpp
===================================================================
RCS file: /home/pooma/Repository/r2/src/Utilities/tests/delete_test1.cpp,v
retrieving revision 1.7
diff -c -p -r1.7 delete_test1.cpp
*** delete_test1.cpp 2001/03/21 00:56:09 1.7
--- delete_test1.cpp 2001/05/24 00:22:49
*************** int main(int argc, char *argv[])
*** 94,100 ****
typedef std::vector<int> KillList_t;
! typedef std::vector<double> Array_t;
void delete_shiftup_orig (Array_t &data, const KillList_t &killList);
void delete_shiftup_test1(Array_t &data, const KillList_t &killList);
--- 94,100 ----
typedef std::vector<int> KillList_t;
! typedef std::vector<int> Array_t;
void delete_shiftup_orig (Array_t &data, const KillList_t &killList);
void delete_shiftup_test1(Array_t &data, const KillList_t &killList);
*************** void delete_shiftup_test2(Array_t &data,
*** 618,635 ****
if (inext < killed)
copy_end_index = killList[inext];
! const int length = copy_end_index - copy_begin_index;
!
! if (length < 100)
! std::copy(data_begin + copy_begin_index,
! data_begin + copy_end_index,
! data_begin + insert_index);
! else
! std::memmove(data_begin + insert_index,
! data_begin + copy_begin_index,
! sizeof(Array_t::value_type)*length);
!
! insert_index += length;
}
}
--- 618,627 ----
if (inext < killed)
copy_end_index = killList[inext];
! std::copy(data_begin + copy_begin_index,
! data_begin + copy_end_index,
! data_begin + insert_index);
! insert_index += copy_end_index - copy_begin_index;
}
}
More information about the pooma-dev
mailing list