diff options
author | Eric Dumazet <edumazet@google.com> | 2012-08-07 06:45:47 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-08-07 19:24:55 -0400 |
commit | 79cda75a107da0d49732b5cb642b456264dd7e0e (patch) | |
tree | 7cffe187b2ff7732f6002d7fc373f87cb93837b9 /net/ipv4/fib_trie.c | |
parent | 425f09ab7d1c9da6ca4137dd639cb6fe3f8a88f3 (diff) |
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 <edumazet@google.com>
Cc: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_trie.c')
-rw-r--r-- | net/ipv4/fib_trie.c | 3 |
1 files changed, 2 insertions, 1 deletions
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, | |||
1550 | * state.directly. | 1550 | * state.directly. |
1551 | */ | 1551 | */ |
1552 | if (pref_mismatch) { | 1552 | if (pref_mismatch) { |
1553 | int mp = KEYLENGTH - fls(pref_mismatch); | 1553 | /* fls(x) = __fls(x) + 1 */ |
1554 | int mp = KEYLENGTH - __fls(pref_mismatch) - 1; | ||
1554 | 1555 | ||
1555 | if (tkey_extract_bits(cn->key, mp, cn->pos - mp) != 0) | 1556 | if (tkey_extract_bits(cn->key, mp, cn->pos - mp) != 0) |
1556 | goto backtrace; | 1557 | goto backtrace; |