aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2021-10-27 17:31:46 +0200
committerDamjan Marion <damarion@cisco.com>2021-10-27 17:34:17 +0200
commitbd908d5ac9c3b8b54c5ddaf09cc356e5b4d0ee35 (patch)
treeafed0d32449df02bfeb1bd9ce9d085e3cf367cd6 /src/vppinfra
parent2b9a4bf3b307870324715bab698204f286368cc0 (diff)
vppinfra: use bzhi in pow2_mask when available
Saves one clock.... Type: improvement Change-Id: I43da40fb4887b77ac851f759c50a7ca2814f8f40 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra')
-rw-r--r--src/vppinfra/clib.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/vppinfra/clib.h b/src/vppinfra/clib.h
index f0c3aca1e03..81b59e21a0b 100644
--- a/src/vppinfra/clib.h
+++ b/src/vppinfra/clib.h
@@ -251,6 +251,9 @@ min_log2_u64 (u64 x)
always_inline uword
pow2_mask (uword x)
{
+#ifdef __BMI2__
+ return _bzhi_u64 (-1ULL, x);
+#endif
return ((uword) 1 << x) - (uword) 1;
}