From 15a4f4962fad9e1777bcc662b3391f521ace8c5b Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 22 Aug 2018 10:43:46 -0700 Subject: [PATCH] lib/axmap: Simplify axmap_set_fn() Instead of handling ffz(~overlap) == bit as a special case, handle this case in the same way as ffz(~overlap) != bit. This patch does not change any functionality but removes one if-instruction from the hot path. Signed-off-by: Bart Van Assche --- lib/axmap.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/axmap.c b/lib/axmap.c index 781a1039..336d7048 100644 --- a/lib/axmap.c +++ b/lib/axmap.c @@ -235,18 +235,12 @@ static bool axmap_set_fn(struct axmap_level *al, unsigned long offset, */ overlap = al->map[offset] & mask; if (overlap == mask) { -done: data->set_bits = 0; return true; } if (overlap) { - const int __bit = ffz(~overlap); - - nr_bits = __bit - bit; - if (!nr_bits) - goto done; - + nr_bits = ffz(~overlap) - bit; mask = bit_masks[nr_bits] << bit; } -- 2.25.1