xiaoxiang781216 commented on code in PR #12427: URL: https://github.com/apache/nuttx/pull/12427#discussion_r1621600053
########## sched/init/nx_start.c: ########## @@ -68,6 +69,10 @@ #define SCHED_ALL_CPUS ((1 << CONFIG_SMP_NCPUS) - 1) +#if !POWER_OF_TWO(CONFIG_PIDHASH_INITIAL_LENGTH) Review Comment: change to static_assert ########## include/nuttx/lib/math32.h: ########## @@ -59,6 +59,10 @@ #define LOG2_CEIL(n) ((n) & (n - 1) ? FLS(n) : FLS(n) - 1) Review Comment: replace `((n) & (n - 1)` with new macro ########## include/nuttx/lib/math32.h: ########## @@ -59,6 +59,10 @@ #define LOG2_CEIL(n) ((n) & (n - 1) ? FLS(n) : FLS(n) - 1) #define LOG2_FLOOR(n) (FLS(n) - 1) +/* Checks if an integer is power-of-two at compile time */ + +#define POWER_OF_TWO(n) ((n) > 0 && ((n) & (n - 1)) == 0) Review Comment: IS_POWER_OF_2 and move before line 55 -- 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]
