modem-helpers: new helper to count number of bits set in a bitmask

This commit is contained in:
Aleksander Morgado
2011-12-02 09:55:39 +01:00
parent a181b152a1
commit 3dcdc3c920
2 changed files with 12 additions and 0 deletions

View File

@@ -1441,3 +1441,13 @@ done:
return array;
}
guint
mm_count_bits_set (gulong number)
{
guint c;
for (c = 0; number; c++)
number &= number - 1;
return c;
}