Commit 33963c43 authored by TOKITA Hiroshi's avatar TOKITA Hiroshi Committed by Carles Cufi
Browse files

drivers: counter: nrfx_timer: Remove is_bit_mask() implementation



Replace is_bit_mask() with IS_BIT_MASK() and remove the implementation.

Signed-off-by: default avatarTOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
parent 21dc3f58
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -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;
	}