From: Eric Dumazet Date: Tue, 7 Aug 2012 10:45:47 +0000 (+0000) Subject: fib: use __fls() on non null argument X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=79cda75a107da0d49732b5cb642b456264dd7e0e;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git fib: use __fls() on non null argument __fls(x) is a bit faster than fls(x), granted we know x is non null. As Ben Hutchings pointed out, fls(x) = __fls(x) + 1 Signed-off-by: Eric Dumazet Cc: Ben Hutchings Signed-off-by: David S. Miller --- diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index f0cdb30921c0..f84a0e90d675 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c @@ -1550,7 +1550,8 @@ int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, * state.directly. */ if (pref_mismatch) { - int mp = KEYLENGTH - fls(pref_mismatch); + /* fls(x) = __fls(x) + 1 */ + int mp = KEYLENGTH - __fls(pref_mismatch) - 1; if (tkey_extract_bits(cn->key, mp, cn->pos - mp) != 0) goto backtrace;