Code Review
/
vpp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
review
|
tree
raw
|
patch
| inline |
side by side
(parent:
2b9a4bf
)
vppinfra: use bzhi in pow2_mask when available
61/34261/1
author
Damjan Marion
<damarion@cisco.com>
Wed, 27 Oct 2021 15:31:46 +0000
(17:31 +0200)
committer
Damjan Marion
<damarion@cisco.com>
Wed, 27 Oct 2021 15:34:17 +0000
(17:34 +0200)
Saves one clock....
Type: improvement
Change-Id: I43da40fb4887b77ac851f759c50a7ca2814f8f40
Signed-off-by: Damjan Marion <damarion@cisco.com>
src/vppinfra/clib.h
patch
|
blob
|
history
diff --git
a/src/vppinfra/clib.h
b/src/vppinfra/clib.h
index
f0c3aca
..
81b59e2
100644
(file)
--- 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;
}