mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 05:31:08 -04:00
lib/bitmap.c: micro-optimization for __bitmap_complement()
Use BITS_TO_LONGS() macro to avoid calculation of reminder (bits % BITS_PER_LONG) On ARM64 it saves 5 instruction for function - 16 before and 11 after. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Yury Norov <[email protected]> Reviewed-by: Andrew Morton <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Rasmus Villemoes <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
1 parent
0455c74788
commit
ca1250bbd4
1 file changed
+1
-4
+1
-4
@@ -64,12 +64,9 @@ EXPORT_SYMBOL(__bitmap_equal);
|
||||
|
||||
void __bitmap_complement(unsigned long *dst, const unsigned long *src, unsigned int bits)
|
||||
{
|
||||
unsigned int k, lim = bits/BITS_PER_LONG;
|
||||
unsigned int k, lim = BITS_TO_LONGS(bits);
|
||||
for (k = 0; k < lim; ++k)
|
||||
dst[k] = ~src[k];
|
||||
|
||||
if (bits % BITS_PER_LONG)
|
||||
dst[k] = ~src[k];
|
||||
}
|
||||
EXPORT_SYMBOL(__bitmap_complement);
|
||||
|
||||
|
||||
Reference in new issue
Block a user