X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=lib%2Flibrte_sched%2Frte_reciprocal.c;h=385109cd51f5346ef851bdd6adf029dae51c4b34;hb=597cb1874068054d4c0be41f161a72ef37888930;hp=652f0237aa29db9981e330bde811a4a35787eb7d;hpb=6e7cbd63706f3435b9d9a2057a37db1da01db9a7;p=deb_dpdk.git diff --git a/lib/librte_sched/rte_reciprocal.c b/lib/librte_sched/rte_reciprocal.c index 652f0237..385109cd 100644 --- a/lib/librte_sched/rte_reciprocal.c +++ b/lib/librte_sched/rte_reciprocal.c @@ -38,28 +38,13 @@ #include "rte_reciprocal.h" -/* find largest set bit. - * portable and slow but does not matter for this usage. - */ -static inline int fls(uint32_t x) -{ - int b; - - for (b = 31; b >= 0; --b) { - if (x & (1u << b)) - return b + 1; - } - - return 0; -} - struct rte_reciprocal rte_reciprocal_value(uint32_t d) { struct rte_reciprocal R; uint64_t m; int l; - l = fls(d - 1); + l = rte_fls_u32(d - 1); m = ((1ULL << 32) * ((1ULL << l) - d)); m /= d;