aboutsummaryrefslogtreecommitdiff
path: root/lib/find_bit.c
AgeCommit message (Collapse)AuthorFilesLines
2017-02-24lib/find_bit.c: micro-optimise find_next_*_bitMatthew Wilcox1-2/+2
This saves 32 bytes on my x86-64 build, mostly due to alignment considerations and sharing more code between find_next_bit and find_next_zero_bit, but it does save a couple of instructions. There's really two parts to this commit: - First, the first half of the test: (!nbits || start >= nbits) is trivially a subset of the second half, since nbits and start are both unsigned - Second, while looking at the disassembly, I noticed that GCC was predicting the branch taken. Since this is a failure case, it's clearly the less likely of the two branches, so add an unlikely() to override GCC's heuristics. [[email protected]: v2] Link: http://lkml.kernel.org/r/[email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Matthew Wilcox <[email protected]> Acked-by: Yury Norov <[email protected]> Acked-by: Rasmus Villemoes <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2015-04-17lib: rename lib/find_next_bit.c to lib/find_bit.cYury Norov1-0/+193
This file contains implementation for all find_*_bit{,_le} So giving it more generic name looks reasonable. Signed-off-by: Yury Norov <[email protected]> Reviewed-by: Rasmus Villemoes <[email protected]> Reviewed-by: George Spelvin <[email protected]> Cc: Alexey Klimov <[email protected]> Cc: David S. Miller <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: Hannes Frederic Sowa <[email protected]> Cc: Lai Jiangshan <[email protected]> Cc: Mark Salter <[email protected]> Cc: AKASHI Takahiro <[email protected]> Cc: Thomas Graf <[email protected]> Cc: Valentin Rothberg <[email protected]> Cc: Chris Wilson <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>