aboutsummaryrefslogtreecommitdiff
path: root/include/linux/string.h
diff options
context:
space:
mode:
authorRasmus Villemoes <linux@rasmusvillemoes.dk>2015-02-13 14:36:13 -0800
committerMister Oyster <oysterized@gmail.com>2017-04-11 10:59:36 +0200
commitfcfcf9fea498504630b0585a3c18add8c1c0fdc9 (patch)
tree62cf7121ddede6dfcc04184b5c6c48ca153224b1 /include/linux/string.h
parentd83e0f90a3a7087d5c8db28e990d807b31781c74 (diff)
lib: bitmap: change bitmap_shift_left to take unsigned parameters
gcc can generate slightly better code for stuff like "nbits % BITS_PER_LONG" when it knows nbits is not negative. Since negative size bitmaps or shift amounts don't make sense, change these parameters of bitmap_shift_right to unsigned. If off >= lim (which requires shift >= nbits), k is initialized with a large positive value, but since I've let k continue to be signed, the loop will never run and dst will be zeroed as expected. Inside the loop, k is guaranteed to be non-negative, so the fact that it is promoted to unsigned in the various expressions it appears in is harmless. Also use "shift" and "nbits" consistently for the parameter names. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/string.h')
0 files changed, 0 insertions, 0 deletions