Skip to content
Commit b2268016 authored by Radu Rendec's avatar Radu Rendec Committed by David S. Miller
Browse files

[PKT_SCHED] CLS_U32: Use ffs() instead of C code on hash mask to get first set bit.



Computing the rank of the first set bit in the hash mask (for using later
in u32_hash_fold()) was done with plain C code. Using ffs() instead makes
the code more readable and improves performance (since ffs() is better
optimized in assembler).

Using the conditional operator on hash mask before applying ntohl() also
saves one ntohl() call if mask is 0.

Signed-off-by: default avatarRadu Rendec <radu.rendec@ines.ro>
Signed-off-by: default avatarJarek Poplawski <jarkao2@o2.pl>
Acked-by: default avatarJamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 78608ba0
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment