This is an automated email from the ASF dual-hosted git repository. GUIDINGLI pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 848427137a739636123fea594589082739b86eec Author: menganqi1 <[email protected]> AuthorDate: Mon Nov 23 20:55:05 2026 +0800 lib/math32: keep LOG2_CEIL() a constant expression on TASKING TASKING maps __builtin_clz() to the __clz() intrinsic, which is not an integer constant expression. In the LOG2_CEIL() path through log2ceil()/flsx()/flsl() this breaks static_assert()s and array bounds, e.g. MM_MIN_SHIFT in mm/mm_heap/mm.h (ctc E231). Use the FLS() based form whenever the compiler is TASKING. Co-authored-by: ouyangxiangzhen <[email protected]> Signed-off-by: menganqi1 <[email protected]> --- include/nuttx/lib/math32.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/include/nuttx/lib/math32.h b/include/nuttx/lib/math32.h index e52fb7432cf..a8b7cfe9d5d 100644 --- a/include/nuttx/lib/math32.h +++ b/include/nuttx/lib/math32.h @@ -79,12 +79,7 @@ */ #define LOG2_FLOOR(n) (FLS(n) - 1) - -#ifdef CONFIG_HAVE_BUILTIN_CLZ -# define LOG2_CEIL(n) log2ceil(n) -#else -# define LOG2_CEIL(n) (FLS((n) - 1)) -#endif +#define LOG2_CEIL(n) (FLS((n) - 1)) /**************************************************************************** * Public Types
