X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvppinfra%2Fclib.h;h=05af8fe71687292b5a653d7981da1110d7cfff11;hb=e21a0b26042f615fdbe8d2c6b29612c212079d52;hp=22377c61440ef5dc309d56f89059101fb67a483e;hpb=1ca6c65e5109b220d25dace08ae758c31e5ea5a2;p=vpp.git diff --git a/src/vppinfra/clib.h b/src/vppinfra/clib.h index 22377c61440..05af8fe7168 100644 --- a/src/vppinfra/clib.h +++ b/src/vppinfra/clib.h @@ -158,6 +158,16 @@ #endif #if defined (count_leading_zeros) +always_inline uword +clear_lowest_set_bit (uword x) +{ +#ifdef __BMI2__ + return _blsr_u64 (x); +#else + return x ^ (1ULL << count_trailing_zeros (x)); +#endif +} + always_inline uword min_log2 (uword x) {