[MOAB-dev] r1432 - MOAB/trunk
tautges at mcs.anl.gov
tautges at mcs.anl.gov
Thu Nov 29 15:37:50 CST 2007
Author: tautges
Date: 2007-11-29 15:37:49 -0600 (Thu, 29 Nov 2007)
New Revision: 1432
Modified:
MOAB/trunk/SequenceData.cpp
Log:
Fixing bug copying default values into newly malloc'd tag memory for odd-sized sequences.
Passes make check.
Modified: MOAB/trunk/SequenceData.cpp
===================================================================
--- MOAB/trunk/SequenceData.cpp 2007-11-29 21:12:13 UTC (rev 1431)
+++ MOAB/trunk/SequenceData.cpp 2007-11-29 21:37:49 UTC (rev 1432)
@@ -14,10 +14,12 @@
char* array = (char*)malloc( bytes_per_ent * size() );
if (initial_value) {
memcpy( array, initial_value, bytes_per_ent );
- const size_t last = size() / 2;
- size_t count;
- for (count = 1; count < last; count *= 2)
+ unsigned count = 1;
+ while (2*count < size()) {
memcpy( array + count * bytes_per_ent, array, count * bytes_per_ent );
+ count *= 2;
+ }
+
memcpy( array + count * bytes_per_ent, array, (size() - count) * bytes_per_ent );
}
else {
More information about the moab-dev
mailing list