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


##########
include/nuttx/lib/math32.h:
##########
@@ -315,34 +315,45 @@ extern "C"
       } \
     while (0)
 
-#if defined(CONFIG_HAVE_EXPRESSION_STATEMENT)
-#  define div64_const(n, base) \
-    ({ \
-      uint64_t __n = (n); \
-      uint32_t __base = (base); \
-      if (IS_POWER_OF_2(__base)) \
-        { \
-          (__n) >>= LOG2_FLOOR(__base); \
-        } \
-      else if (UINTPTR_MAX == UINT32_MAX) \
-        { \
-          div64_const32(__n, __base); \
-        } \
-      else \
-        { \
-          __n /= __base; \
-        } \
-        __n; \
-      })
+#if !defined(CONFIG_LIBC_DISABLE_DIV64_OPTIMIZATION) && \

Review Comment:
   This turns div64_const() on for every GCC and Clang build, at every 
optimisation level. MemBrowse for this head shows s698pm-dkit .text +46,448 B 
(+12.1%), and CI overflows flash in mr-navq95b:nsh (1040 B), imx95-evk:nsh 
(1024 B) and b-g431b-esc1:nsh (104 B), which build on master.
   
   Fix: limit it as #20996 does (DEBUG_FULLOPT, 32-bit, not 
sparc/xtensa/renesas), or join #20996, which changes the same macros for the 
same problem.



-- 
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