gustavonihei commented on code in PR #7449: URL: https://github.com/apache/incubator-nuttx/pull/7449#discussion_r1007044127
########## include/nuttx/lib/math32.h: ########## @@ -29,6 +29,35 @@ #include <stdint.h> +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Returns one plus the index of the most significant 1-bit of n, + * or if n is zero, returns zero. + */ + +#if UINTPTR_MAX > UINT32_MAX +#define FLS(n) ((n) & 0xffffffff00000000ull ? 32 + \ Review Comment: ```suggestion #define FLS(n) ((n) & UINT64_C(0xffffffff00000000) ? 32 + \ ``` Improve portability by using the conversion macros from `inttypes.h`. For 64-bit architectures (e.g. RV64) the `ul` should be sufficient. ########## include/nuttx/lib/math32.h: ########## @@ -29,6 +29,35 @@ #include <stdint.h> +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Returns one plus the index of the most significant 1-bit of n, + * or if n is zero, returns zero. + */ + +#if UINTPTR_MAX > UINT32_MAX +#define FLS(n) ((n) & 0xffffffff00000000ull ? 32 + \ Review Comment: ```suggestion #define FLS(n) ((n) & UINT64_C(0xffffffff00000000) ? 32 + \ ``` Improve portability by using the conversion macros from `inttypes.h`. For 64-bit architectures (e.g. RV64) the `ul` suffix should be sufficient. -- 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: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org