am 914b65fc: am 451dd85f: liblogwrap: replace loops with calls to TEMP_FAILURE_RETRY
* commit '914b65fcb9d445059a1b51ce5ecd7552e0ea8c8b':
liblogwrap: replace loops with calls to TEMP_FAILURE_RETRY
diff --git a/include/cutils/bitops.h b/include/cutils/bitops.h
index eb44236..c26dc54 100644
--- a/include/cutils/bitops.h
+++ b/include/cutils/bitops.h
@@ -75,6 +75,16 @@
return -1;
}
+static inline int bitmask_weight(unsigned int *bitmask, int num_bits)
+{
+ int i;
+ int weight = 0;
+
+ for (i = 0; i < BITS_TO_WORDS(num_bits); i++)
+ weight += __builtin_popcount(bitmask[i]);
+ return weight;
+}
+
static inline void bitmask_set(unsigned int *bitmask, int bit)
{
bitmask[BIT_WORD(bit)] |= BIT_MASK(bit);