Skip to content
Snippets Groups Projects
Commit 5c4146cc authored by Moe Jette's avatar Moe Jette
Browse files

minor optimization in bitmap logic,

parent c78affc9
No related branches found
No related tags found
No related merge requests found
......@@ -1301,8 +1301,10 @@ static int _eval_nodes_topo(struct job_record *job_ptr, bitstr_t *bitmap,
if (switches_node_cnt[j] == 0)
continue;
first = bit_ffs(switches_bitmap[j]);
if (first < 0)
continue;
last = bit_fls(switches_bitmap[j]);
for (i=first; ((i<=last) && (first>=0)); i++) {
for (i=first; i<=last; i++) {
if (!bit_test(switches_bitmap[j], i))
continue;
if (!bit_test(avail_nodes_bitmap, i)) {
......@@ -1321,8 +1323,10 @@ static int _eval_nodes_topo(struct job_record *job_ptr, bitstr_t *bitmap,
/* No specific required nodes, calculate CPU counts */
for (j=0; j<switch_record_cnt; j++) {
first = bit_ffs(switches_bitmap[j]);
if (first < 0)
continue;
last = bit_fls(switches_bitmap[j]);
for (i=first; ((i<=last) && (first>=0)); i++) {
for (i=first; i<=last; i++) {
if (!bit_test(switches_bitmap[j], i))
continue;
switches_cpu_cnt[j] +=
......
......@@ -1228,8 +1228,10 @@ static int _job_test_topo(struct job_record *job_ptr, bitstr_t *bitmap,
if (switches_node_cnt[j] == 0)
continue;
first = bit_ffs(switches_bitmap[j]);
if (first < 0)
continue;
last = bit_fls(switches_bitmap[j]);
for (i=first; ((i<=last) && (first>=0)); i++) {
for (i=first; i<=last; i++) {
if (!bit_test(switches_bitmap[j], i))
continue;
if (!bit_test(avail_nodes_bitmap, i)) {
......@@ -1246,8 +1248,10 @@ static int _job_test_topo(struct job_record *job_ptr, bitstr_t *bitmap,
/* No specific required nodes, calculate CPU counts */
for (j=0; j<switch_record_cnt; j++) {
first = bit_ffs(switches_bitmap[j]);
if (first < 0)
continue;
last = bit_fls(switches_bitmap[j]);
for (i=first; ((i<=last) && (first>=0)); i++) {
for (i=first; i<=last; i++) {
if (!bit_test(switches_bitmap[j], i))
continue;
switches_cpu_cnt[j] +=
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment