drivers: counter: nrfx_rtc: Remove is_bit_mask() implementation
Replace is_bit_mask() with IS_BIT_MASK() and remove the implementation. Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
This commit is contained in:
parent
429b05a79a
commit
21dc3f58e4
1 changed files with 2 additions and 8 deletions
|
@ -102,12 +102,6 @@ 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));
|
||||
}
|
||||
|
||||
/* Function calculates distance between to values assuming that one first
|
||||
* argument is in front and that values wrap.
|
||||
*/
|
||||
|
@ -116,7 +110,7 @@ static uint32_t ticks_sub(const struct device *dev, uint32_t val,
|
|||
{
|
||||
if (IS_FIXED_TOP(dev)) {
|
||||
return (val - old) & COUNTER_MAX_TOP_VALUE;
|
||||
} else if (likely(is_bit_mask(top))) {
|
||||
} else if (likely(IS_BIT_MASK(top))) {
|
||||
return (val - old) & top;
|
||||
}
|
||||
|
||||
|
@ -146,7 +140,7 @@ static uint32_t ticks_add(const struct device *dev, uint32_t val1,
|
|||
ARG_UNUSED(top);
|
||||
return sum & COUNTER_MAX_TOP_VALUE;
|
||||
}
|
||||
if (likely(is_bit_mask(top))) {
|
||||
if (likely(IS_BIT_MASK(top))) {
|
||||
sum = sum & top;
|
||||
} else {
|
||||
sum = sum > top ? sum - (top + 1) : sum;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue