[PKT_SCHED] CLS_U32: Use ffs() instead of C code on hash mask to get first set bit.
authorRadu Rendec <radu.rendec@ines.ro>
Sun, 11 Nov 2007 05:54:50 +0000 (21:54 -0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 11 Nov 2007 05:54:50 +0000 (21:54 -0800)
commitb226801676d9533d09da511eb379fe970fa1a770
treef4ad60091e226c9c93deaa9353849b6dea1c0c0e
parent78608ba0326f1448f9a10dbb402a38192559f639
[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: Radu Rendec <radu.rendec@ines.ro>
Signed-off-by: Jarek Poplawski <jarkao2@o2.pl>
Acked-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/cls_u32.c