projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
67f4efd
)
sctp: use bitmap_weight
author
Akinobu Mita
<
[email protected]
>
Fri, 16 Nov 2012 20:39:49 +0000
(20:39 +0000)
committer
David S. Miller
<
[email protected]
>
Sun, 18 Nov 2012 03:01:18 +0000
(22:01 -0500)
Use bitmap_weight to count the total number of bits set in bitmap.
Signed-off-by: Akinobu Mita <
[email protected]
>
Cc: Vlad Yasevich <
[email protected]
>
Cc: Sridhar Samudrala <
[email protected]
>
Cc:
[email protected]
Cc:
[email protected]
Acked-by: Vlad Yasevich <
[email protected]
>
Signed-off-by: David S. Miller <
[email protected]
>
net/sctp/tsnmap.c
patch
|
blob
|
history
diff --git
a/net/sctp/tsnmap.c
b/net/sctp/tsnmap.c
index b5fb7c409023ff8adea81d41e68ace60781febae..5f25e0c92c31e48460536cd2bb0fc29549172b93 100644
(file)
--- a/
net/sctp/tsnmap.c
+++ b/
net/sctp/tsnmap.c
@@
-272,7
+272,7
@@
__u16 sctp_tsnmap_pending(struct sctp_tsnmap *map)
__u32 max_tsn = map->max_tsn_seen;
__u32 base_tsn = map->base_tsn;
__u16 pending_data;
- u32 gap
, i
;
+ u32 gap;
pending_data = max_tsn - cum_tsn;
gap = max_tsn - base_tsn;
@@
-280,11
+280,7
@@
__u16 sctp_tsnmap_pending(struct sctp_tsnmap *map)
if (gap == 0 || gap >= map->len)
goto out;
- for (i = 0; i < gap+1; i++) {
- if (test_bit(i, map->tsn_map))
- pending_data--;
- }
-
+ pending_data -= bitmap_weight(map->tsn_map, gap + 1);
out:
return pending_data;
}