From a1a4ab815fe74ba54086b92206cf632b6c3aba4c Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 22 Aug 2018 13:35:19 -0700 Subject: [PATCH] lib/axmap: Inline ulog64() Since the function ulog64() only has one caller and since it can be replaced by a single closed-form expression, inline that function. Signed-off-by: Bart Van Assche --- lib/axmap.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/axmap.c b/lib/axmap.c index 4a907fec..0d8fbf8d 100644 --- a/lib/axmap.c +++ b/lib/axmap.c @@ -83,14 +83,6 @@ struct axmap { uint64_t nr_bits; }; -static inline unsigned long ulog64(unsigned long val, unsigned int log) -{ - while (log-- && val) - val >>= UNIT_SHIFT; - - return val; -} - /* Remove all elements from the @axmap set */ void axmap_reset(struct axmap *axmap) { @@ -202,7 +194,7 @@ static bool axmap_handler_topdown(struct axmap *axmap, uint64_t bit_nr, int i; for (i = axmap->nr_levels - 1; i >= 0; i--) { - unsigned long index = ulog64(bit_nr, i); + unsigned long index = bit_nr >> (UNIT_SHIFT * i); unsigned long offset = index >> UNIT_SHIFT; unsigned int bit = index & BLOCKS_PER_UNIT_MASK; -- 2.25.1