diff options
author | Damjan Marion <damarion@cisco.com> | 2023-04-04 17:06:26 +0000 |
---|---|---|
committer | Ole Tr�an <otroan@employees.org> | 2023-04-06 08:00:08 +0000 |
commit | 5294cdc79213a8703f70d9a300b0c5806c788ca4 (patch) | |
tree | dcf97886f8331b832a46ca71e9f4bb5a61358373 /src/vppinfra/clib.h | |
parent | 1315d14d4c022d6fcfe43e6223b8ff557508b31f (diff) |
vppinfra: refactor uword bitmaps
Type: improvement
Change-Id: I4f05a0435825cd23b8ad8a6f8f1397e60c522319
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/clib.h')
-rw-r--r-- | src/vppinfra/clib.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/vppinfra/clib.h b/src/vppinfra/clib.h index 7a8029a30bd..b8257bf1164 100644 --- a/src/vppinfra/clib.h +++ b/src/vppinfra/clib.h @@ -197,6 +197,15 @@ decl __attribute ((destructor)); \ decl +always_inline uword +pow2_mask (uword x) +{ +#ifdef __BMI2__ + return _bzhi_u64 (-1ULL, x); +#endif + return ((uword) 1 << x) - (uword) 1; +} + #include <vppinfra/bitops.h> always_inline uword @@ -237,15 +246,6 @@ 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; -} - -always_inline uword max_pow2 (uword x) { word y = (word) 1 << min_log2 (x); |