Skip to content

Commit aa6f87d

Browse files
sandro97gitfabiobaltieri
authored andcommitted
style: fix readability-math-missing-parentheses warnings
If a project has enabled the clang-tidy check readability-math-missing-parentheses, then warnings are raised on usage of some macros (e.g ARRAY_SIZE and K_MSEC). Signed-off-by: Sandro Scherer <[email protected]>
1 parent 0db74e3 commit aa6f87d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

include/zephyr/sys/time_units.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ static inline unsigned int z_impl_sys_clock_hw_cycles_per_sec_runtime_get(void)
188188

189189
/* Integer multiplication 32-bit conversion */
190190
#define z_tmcvt_int_mul_32(__t, __from_hz, __to_hz) \
191-
(uint32_t) ((__t)*((__to_hz) / (__from_hz)))
191+
((uint32_t) ((__t)*((__to_hz) / (__from_hz))))
192192

193193
/* General 32-bit conversion */
194194
#define z_tmcvt_gen_32(__t, __from_hz, __to_hz, __round_up, __round_off) \
@@ -212,9 +212,9 @@ static inline unsigned int z_impl_sys_clock_hw_cycles_per_sec_runtime_get(void)
212212

213213
/* Slow 64-bit conversion. This avoids overflowing the multiply */
214214
#define z_tmcvt_gen_64_slow(__t, __from_hz, __to_hz, __round_up, __round_off) \
215-
(((uint64_t) (__t) / (__from_hz))*(__to_hz) + \
216-
(((uint64_t) (__t) % (__from_hz))*(__to_hz) + \
217-
z_tmcvt_off_gen(__from_hz, __to_hz, __round_up, __round_off)) / (__from_hz))
215+
((((uint64_t) (__t) / (__from_hz))*(__to_hz)) + \
216+
(((((uint64_t) (__t) % (__from_hz))*(__to_hz)) + \
217+
z_tmcvt_off_gen(__from_hz, __to_hz, __round_up, __round_off)) / (__from_hz)))
218218

219219
/* General 64-bit conversion. Uses one of the two above macros */
220220
#define z_tmcvt_gen_64(__t, __from_hz, __to_hz, __round_up, __round_off) \

include/zephyr/sys/util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ extern "C" {
8888
(((~0ULL) - (1ULL << (l)) + 1) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h))))
8989

9090
/** @brief 0 if @p cond is true-ish; causes a compile error otherwise. */
91-
#define ZERO_OR_COMPILE_ERROR(cond) ((int) sizeof(char[1 - 2 * !(cond)]) - 1)
91+
#define ZERO_OR_COMPILE_ERROR(cond) ((int) sizeof(char[1 - (2 * !(cond))]) - 1)
9292

9393
#if defined(__cplusplus)
9494

0 commit comments

Comments
 (0)