From bed6b69bb6b8531aaeed12d92f59ef7b030b98e6 Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Mon, 12 Mar 2007 22:52:14 +0000 Subject: [PATCH] Remove unused function bit_and_set_count, Move it's faster logic into the function bit_overlap, which is used. --- src/common/bitstring.c | 32 +++----------------------------- src/common/bitstring.h | 1 - 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/src/common/bitstring.c b/src/common/bitstring.c index 730ad326d48..580e5d95b60 100644 --- a/src/common/bitstring.c +++ b/src/common/bitstring.c @@ -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) diff --git a/src/common/bitstring.h b/src/common/bitstring.h index 156ec25eb50..301d0b21d7a 100644 --- a/src/common/bitstring.h +++ b/src/common/bitstring.h @@ -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); -- GitLab