Commit bd8e0449 authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

only swap indices if needed.

parent 3aa1127a
...@@ -4615,7 +4615,8 @@ void engine_unskip(struct engine *e) { ...@@ -4615,7 +4615,8 @@ void engine_unskip(struct engine *e) {
(e->policy & (e->policy &
(engine_policy_self_gravity | engine_policy_external_gravity) && (engine_policy_self_gravity | engine_policy_external_gravity) &&
cell_is_active_gravity(c, e))) { cell_is_active_gravity(c, e))) {
memswap(&local_cells[k], &local_cells[num_active_cells], sizeof(int)); if (num_active_cells != k)
memswap(&local_cells[k], &local_cells[num_active_cells], sizeof(int));
num_active_cells += 1; num_active_cells += 1;
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment