summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2016-09-18 03:32:02 -0800
committerKent Overstreet <kent.overstreet@gmail.com>2016-09-18 06:25:54 -0800
commit2bdac58adbf9ae6c69d292f707b86bca51471afe (patch)
tree8b000266ccfd00fb6e891369297f692c90acbf0a
parent81973bd4cbcd44e0ee3ea456bfd3d0e8412d7349 (diff)
bcache: make bkey_unpack() a bit faster
-rw-r--r--drivers/md/bcache/bkey.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/md/bcache/bkey.c b/drivers/md/bcache/bkey.c
index c20ab1caa746..1ba98f0e7f87 100644
--- a/drivers/md/bcache/bkey.c
+++ b/drivers/md/bcache/bkey.c
@@ -166,12 +166,10 @@ static u64 get_inc_field(struct unpack_state *state, unsigned field)
state->bits = 64;
}
- if (likely(bits)) {
- /* avoid shift by 64 if bits is 0 */
- v |= state->w >> (64 - bits);
- state->bits -= bits;
- state->w <<= bits;
- }
+ /* avoid shift by 64 if bits is 0 - bits is never 64 here: */
+ v |= (state->w >> 1) >> (63 - bits);
+ state->w <<= bits;
+ state->bits -= bits;
return v + offset;
}