aboutsummaryrefslogtreecommitdiffstats
path: root/package/broadcom-wl/src/kmod/bcmutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'package/broadcom-wl/src/kmod/bcmutils.c')
-rw-r--r--package/broadcom-wl/src/kmod/bcmutils.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/package/broadcom-wl/src/kmod/bcmutils.c b/package/broadcom-wl/src/kmod/bcmutils.c
index c264ea500b..7592f230ad 100644
--- a/package/broadcom-wl/src/kmod/bcmutils.c
+++ b/package/broadcom-wl/src/kmod/bcmutils.c
@@ -855,3 +855,19 @@ bcm_bprintf(struct bcmstrbuf *b, const char *fmt, ...)
return r;
}
+
+uint
+bcm_bitcount(uint8 *bitmap, uint length)
+{
+ uint bitcount = 0, i;
+ uint8 tmp;
+ for (i = 0; i < length; i++) {
+ tmp = bitmap[i];
+ while (tmp) {
+ bitcount++;
+ tmp &= (tmp - 1);
+ }
+ }
+ return bitcount;
+}
+