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

Remove unused function bit_and_set_count,

Move it's faster logic into the function bit_overlap, which is used.
parent 019d8775
No related branches found
No related tags found
No related merge requests found
......@@ -69,7 +69,6 @@ strong_alias(bit_or, slurm_bit_or);
strong_alias(bit_set_count, slurm_bit_set_count);
strong_alias(bit_clear_count, slurm_bit_clear_count);
strong_alias(bit_nset_max_count,slurm_bit_nset_max_count);
strong_alias(bit_and_set_count, slurm_bit_and_set_count);
strong_alias(int_and_set_count, slurm_int_and_set_count);
strong_alias(bit_rotate_copy, slurm_bit_rotate_copy);
strong_alias(bit_rotate, slurm_bit_rotate);
......@@ -507,16 +506,14 @@ extern int
bit_overlap(bitstr_t *b1, bitstr_t *b2)
{
int count = 0;
bitstr_t *my_bitmap = NULL;
bitoff_t bit;
_assert_bitstr_valid(b1);
_assert_bitstr_valid(b2);
assert(_bitstr_bits(b1) == _bitstr_bits(b2));
my_bitmap = bit_copy(b1);
bit_and(my_bitmap, b2);
count = bit_set_count(my_bitmap);
bit_free(my_bitmap);
for (bit = 0; bit < _bitstr_bits(b); bit += sizeof(bitstr_t)*8)
count += hweight(b1[_bit_word(bit)] & b2[_bit_word(bit)]);
return count;
}
......@@ -729,29 +726,6 @@ bit_nset_max_count(bitstr_t *b)
return maxcnt;
}
/*
* And two bitstrings and count the number of set bits: SUM(b1 & b2)
* b1 (IN) first bitstring
* b2 (IN) second bitstring
*/
int
bit_and_set_count(bitstr_t *b1, bitstr_t *b2) {
bitoff_t bit;
bitstr_t word;
int sum;
_assert_bitstr_valid(b1);
_assert_bitstr_valid(b2);
assert(_bitstr_bits(b1) == _bitstr_bits(b2));
sum = 0;
for (bit = 0; bit < _bitstr_bits(b1); bit += sizeof(bitstr_t)*8) {
word = b1[_bit_word(bit)] & b2[_bit_word(bit)];
sum += hweight(word);
}
return(sum);
}
/*
* And an integer vector and a bitstring and sum the elements corresponding
* to set entries in b2: SUM(i1 & b2)
......
......@@ -168,7 +168,6 @@ void bit_or(bitstr_t *b1, bitstr_t *b2);
int bit_set_count(bitstr_t *b);
int bit_clear_count(bitstr_t *b);
int bit_nset_max_count(bitstr_t *b);
int bit_and_set_count(bitstr_t *b1, bitstr_t *b2);
int int_and_set_count(int *i1, int ilen, bitstr_t *b2);
bitstr_t *bit_rotate_copy(bitstr_t *b1, int n, bitoff_t nbits);
void bit_rotate(bitstr_t *b1, int n);
......
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