Skip to content

Commit

Permalink
include/sys_clock.h: consolidate identical branches in __ticks_to_ms
Browse files Browse the repository at this point in the history
The two branches of the compile-time conditional are identical, so
they are consolidated and the conditional removed.

Just hygiene again.  No functional change.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
  • Loading branch information
Charles E. Youse authored and nashif committed May 8, 2019
1 parent e1cb4ca commit 03199f9
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions include/sys_clock.h
Expand Up @@ -121,15 +121,8 @@ static ALWAYS_INLINE s32_t z_ms_to_ticks(s32_t ms)
static inline u64_t __ticks_to_ms(s64_t ticks) static inline u64_t __ticks_to_ms(s64_t ticks)
{ {
#ifdef CONFIG_SYS_CLOCK_EXISTS #ifdef CONFIG_SYS_CLOCK_EXISTS

return (u64_t)ticks * MSEC_PER_SEC /
#ifdef _NEED_PRECISE_TICK_MS_CONVERSION (u64_t)CONFIG_SYS_CLOCK_TICKS_PER_SEC;
/* use 64-bit math to keep precision */
return (u64_t)ticks * MSEC_PER_SEC / (u64_t)CONFIG_SYS_CLOCK_TICKS_PER_SEC;
#else
/* simple multiplication keeps precision */
return (u64_t)ticks * MSEC_PER_SEC / (u64_t)CONFIG_SYS_CLOCK_TICKS_PER_SEC;
#endif

#else #else
__ASSERT(ticks == 0, "ticks not zero"); __ASSERT(ticks == 0, "ticks not zero");
return 0ULL; return 0ULL;
Expand Down

0 comments on commit 03199f9

Please sign in to comment.