summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
}