X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_eal%2Fcommon%2Finclude%2Frte_common.h;h=e0ab48a9f30ed28731d0d22be92c0dd99767f76c;hb=a366c813f74a50f125b8b2bd8f2448f2b89a3e2e;hp=42152d580f41ee63f27575e547975bbc7d6496b1;hpb=0100a515b5631b5a598e75bdf838870caab50470;p=dpdk.git diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h index 42152d580f..e0ab48a9f3 100644 --- a/lib/librte_eal/common/include/rte_common.h +++ b/lib/librte_eal/common/include/rte_common.h @@ -260,6 +260,26 @@ rte_pause (void) asm volatile ("pause"); } +/** + * Searches the input parameter for the least significant set bit + * (starting from zero). + * If a least significant 1 bit is found, its bit index is returned. + * If the content of the input paramer is zero, then the content of the return + * value is undefined. + * @param v + * input parameter, should not be zero. + * @return + * least significant set bit in the input parameter. + */ +static inline uint32_t +rte_bsf32(uint32_t v) +{ + asm("bsf %1,%0" + : "=r" (v) + : "rm" (v)); + return (v); +} + #ifndef offsetof /** Return the offset of a field in a structure. */ #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)