From 33963c43caafeeb77125e84e2766dc9b3a580b7f Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sun, 11 Dec 2022 19:18:56 +0900 Subject: [PATCH] drivers: counter: nrfx_timer: Remove is_bit_mask() implementation Replace is_bit_mask() with IS_BIT_MASK() and remove the implementation. Signed-off-by: TOKITA Hiroshi --- drivers/counter/counter_nrfx_timer.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/counter/counter_nrfx_timer.c b/drivers/counter/counter_nrfx_timer.c index 6fa9adc899d..64e448f1545 100644 --- a/drivers/counter/counter_nrfx_timer.c +++ b/drivers/counter/counter_nrfx_timer.c @@ -93,17 +93,11 @@ static int get_value(const struct device *dev, uint32_t *ticks) return 0; } -/* Return true if value equals 2^n - 1 */ -static inline bool is_bit_mask(uint32_t val) -{ - return !(val & (val + 1)); -} - static uint32_t ticks_add(uint32_t val1, uint32_t val2, uint32_t top) { uint32_t to_top; - if (likely(is_bit_mask(top))) { + if (likely(IS_BIT_MASK(top))) { return (val1 + val2) & top; } @@ -114,7 +108,7 @@ static uint32_t ticks_add(uint32_t val1, uint32_t val2, uint32_t top) static uint32_t ticks_sub(uint32_t val, uint32_t old, uint32_t top) { - if (likely(is_bit_mask(top))) { + if (likely(IS_BIT_MASK(top))) { return (val - old) & top; }