summaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/hqos
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-05-10 13:40:44 +0200
committerDave Barach <openvpp@barachs.net>2018-05-10 17:16:56 +0000
commit1105600416e0560cb05120a22e0a2e7359a13665 (patch)
treeacf1df08de42344c380473d81886864e662890cf /src/plugins/dpdk/hqos
parent132dc49ee847a3e3b644de8b36499d73e8a8d37e (diff)
vppinfra: use count_trailing_zeros in sparse_vec_index
It is much cheaper to use ctzll than to do shift,subtract and mask in likely case when we are looking for 1st set bit in the uword. Change-Id: I31954081571978878c7098bafad0c85a91755fa2 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins/dpdk/hqos')
-rw-r--r--src/plugins/dpdk/hqos/hqos.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/dpdk/hqos/hqos.c b/src/plugins/dpdk/hqos/hqos.c
index c9b85652863..123ecbab0d3 100644
--- a/src/plugins/dpdk/hqos/hqos.c
+++ b/src/plugins/dpdk/hqos/hqos.c
@@ -168,8 +168,8 @@ int
dpdk_hqos_validate_mask (u64 mask, u32 n)
{
int count = __builtin_popcountll (mask);
- int pos_lead = sizeof (u64) * 8 - __builtin_clzll (mask);
- int pos_trail = __builtin_ctzll (mask);
+ int pos_lead = sizeof (u64) * 8 - count_leading_zeros (mask);
+ int pos_trail = count_trailing_zeros (mask);
int count_expected = __builtin_popcount (n - 1);
/* Handle the exceptions */
@@ -363,15 +363,15 @@ dpdk_port_setup_hqos (dpdk_device_t * xd, dpdk_device_config_hqos_t * hqos)
xd->hqos_wt[tid].hqos_field0_slabpos = hqos->pktfield0_slabpos;
xd->hqos_wt[tid].hqos_field0_slabmask = hqos->pktfield0_slabmask;
xd->hqos_wt[tid].hqos_field0_slabshr =
- __builtin_ctzll (hqos->pktfield0_slabmask);
+ count_trailing_zeros (hqos->pktfield0_slabmask);
xd->hqos_wt[tid].hqos_field1_slabpos = hqos->pktfield1_slabpos;
xd->hqos_wt[tid].hqos_field1_slabmask = hqos->pktfield1_slabmask;
xd->hqos_wt[tid].hqos_field1_slabshr =
- __builtin_ctzll (hqos->pktfield1_slabmask);
+ count_trailing_zeros (hqos->pktfield1_slabmask);
xd->hqos_wt[tid].hqos_field2_slabpos = hqos->pktfield2_slabpos;
xd->hqos_wt[tid].hqos_field2_slabmask = hqos->pktfield2_slabmask;
xd->hqos_wt[tid].hqos_field2_slabshr =
- __builtin_ctzll (hqos->pktfield2_slabmask);
+ count_trailing_zeros (hqos->pktfield2_slabmask);
memcpy (xd->hqos_wt[tid].hqos_tc_table, hqos->tc_table,
sizeof (hqos->tc_table));
}