Skip to content

Commit

Permalink
Merge pull request ceph#18681 from tchaikov/wip-msg-async-popcnt
Browse files Browse the repository at this point in the history
msg/async: use bitset<> to do the popcnt

Reviewed-by: Haomai Wang <[email protected]>
  • Loading branch information
yuyuyu101 authored Nov 2, 2017
2 parents c1d6f83 + 79476d4 commit 0ee9fd2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/msg/async/dpdk/dpdk_rte.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* under the License.
*/

#include <bitset>

#include <rte_config.h>
#include <rte_common.h>
#include <rte_ethdev.h>
Expand All @@ -40,10 +42,7 @@ namespace dpdk {

static int bitcount(unsigned n)
{
unsigned int c =0 ;
for (c = 0; n; ++c)
n &= (n -1);
return c;
return std::bitset<CHAR_BIT * sizeof(n)>{n}.count();
}

int eal::init(CephContext *c)
Expand Down

0 comments on commit 0ee9fd2

Please sign in to comment.