[PPL-devel] Generator_System::adjust_topology_and_space_dimension
Matthew Mundell
mattm at comp.leeds.ac.uk
Wed Sep 21 13:41:21 CEST 2005
I'd like to make the following change to
Generator_System::adjust_topology_and_space_dimension.
In the first `if' statement of adjust_topology_and_space_dimension
variable cols_to_be_added is only ever read. The method returns at
the end of the `if' statement, so addition and subtraction can be used
to calculate the add_zero_columns argument, instead of modifications
to the value of cols_to_be_added.
Does this sound like a sensible change?
Index: src/Generator_System.cc
===================================================================
RCS file: /cvs/ppl/ppl/src/Generator_System.cc,v
retrieving revision 1.9
diff -u -r1.9 Generator_System.cc
--- src/Generator_System.cc 21 Sep 2005 10:56:43 -0000 1.9
+++ src/Generator_System.cc 21 Sep 2005 10:57:53 -0000
@@ -48,12 +48,11 @@
if (num_rows() == 0) {
if (num_columns() == 0)
if (new_topology == NECESSARILY_CLOSED) {
- add_zero_columns(++cols_to_be_added);
+ add_zero_columns(cols_to_be_added + 1);
set_necessarily_closed();
}
else {
- cols_to_be_added += 2;
- add_zero_columns(cols_to_be_added);
+ add_zero_columns(cols_to_be_added + 2);
set_not_necessarily_closed();
}
else
@@ -68,21 +67,20 @@
// Nothing to do.
break;
default:
- add_zero_columns(--cols_to_be_added);
+ add_zero_columns(cols_to_be_added - 1);
}
set_necessarily_closed();
}
else {
// Here old_topology == NECESSARILY_CLOSED
// and new_topology == NOT_NECESSARILY_CLOSED.
- add_zero_columns(++cols_to_be_added);
+ add_zero_columns(cols_to_be_added + 1);
set_not_necessarily_closed();
}
- else {
+ else
// Here topologies agree.
if (cols_to_be_added > 0)
add_zero_columns(cols_to_be_added);
- }
assert(OK());
return true;
}
More information about the PPL-devel
mailing list