casaroli commented on code in PR #20996:
URL: https://github.com/apache/nuttx/pull/20996#discussion_r4398250914


##########
include/nuttx/compiler.h:
##########
@@ -657,6 +657,8 @@
 #    define tz_nonsecure_call  __attribute__((cmse_nonsecure_call))
 #  endif
 
+#  define CONFIG_HAVE_EXPRESSION_STATEMENT 1

Review Comment:
   This define has the same effect as the earlier `#if defined(__GNUC__)`: 
every GCC/Clang build gets the statement-expression `div_const()`. MemBrowse 
for this head shows s698pm-dkit `.text` +74,592 B (+19.6%).
   
   Fix: drop this define, and call `div64_const32()` from `lib_ultoa_invert.c`, 
which math32.h defines without a condition.



##########
include/nuttx/clock.h:
##########
@@ -180,6 +180,8 @@
 #define NSEC2TICK(nsec)       div_const_roundup(nsec, NSEC_PER_TICK)
 #define USEC2TICK(usec)       div_const_roundup(usec, USEC_PER_TICK)
 
+#define MSEC2TICK32(n)        ((n + MSEC_PER_TICK - 1) / MSEC_PER_TICK)

Review Comment:
   `MSEC_PER_TICK` is 0 when `CONFIG_USEC_PER_TICK` is less than 1000 
(arty_a7:nsh-tickless uses 1), so this divides by zero. `MSEC2TICK()` uses 
`USEC2TICK()` for that case (line 188). Also, `n` has no parentheses.
   
   Fix: use the same `#if` as `MSEC2TICK()` (lines 185-189) with plain `/`, and 
write `(n)`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to