Improving clarity of loops

This commit is contained in:
jtclemm 2020-06-11 14:10:26 -06:00 committed by GitHub
parent 006ada3a52
commit ca424772df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 9 deletions

View File

@ -2072,14 +2072,14 @@ void Atom::add_callback(int flag)
memory->grow(extra_grow,nextra_grow_max,"atom:extra_grow"); memory->grow(extra_grow,nextra_grow_max,"atom:extra_grow");
} }
for(i = 0; i < nextra_grow; i ++) for(i = 0; i < nextra_grow; i++)
if(ifix < extra_grow[i]) break; if(ifix < extra_grow[i]) break;
if(i == nextra_grow) { if(i == nextra_grow) {
extra_grow[nextra_grow] = ifix; extra_grow[nextra_grow] = ifix;
} else { } else {
for(j = nextra_grow-1; j >= i; j --) for(j = nextra_grow; j > i; j--)
extra_grow[j+1] = extra_grow[j]; extra_grow[j] = extra_grow[j-1];
extra_grow[i] = ifix; extra_grow[i] = ifix;
} }
@ -2090,14 +2090,14 @@ void Atom::add_callback(int flag)
memory->grow(extra_restart,nextra_restart_max,"atom:extra_restart"); memory->grow(extra_restart,nextra_restart_max,"atom:extra_restart");
} }
for(i = 0; i < nextra_restart; i ++) for(i = 0; i < nextra_restart; i++)
if(ifix < extra_restart[i]) break; if(ifix < extra_restart[i]) break;
if(i == nextra_restart) { if(i == nextra_restart) {
extra_restart[nextra_restart] = ifix; extra_restart[nextra_restart] = ifix;
} else { } else {
for(j = nextra_restart-1; j >= i; j --) for(j = nextra_restart; j > i; j--)
extra_restart[j+1] = extra_restart[j]; extra_restart[j] = extra_restart[j-1];
extra_restart[i] = ifix; extra_restart[i] = ifix;
} }
@ -2108,14 +2108,14 @@ void Atom::add_callback(int flag)
memory->grow(extra_border,nextra_border_max,"atom:extra_border"); memory->grow(extra_border,nextra_border_max,"atom:extra_border");
} }
for(i = 0; i < nextra_border; i ++) for(i = 0; i < nextra_border; i++)
if(ifix < extra_border[i]) break; if(ifix < extra_border[i]) break;
if(i == nextra_border) { if(i == nextra_border) {
extra_border[nextra_border] = ifix; extra_border[nextra_border] = ifix;
} else { } else {
for(j = nextra_border-1; j >= i; j --) for(j = nextra_border; j > i; j--)
extra_border[j+1] = extra_border[j]; extra_border[j] = extra_border[j-1];
extra_border[i] = ifix; extra_border[i] = ifix;
} }