You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/10/27 20:51:38 UTC
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #7449: mm/mm_heap: optimize MM_XX_SHIFT define
pkarashchenko commented on code in PR #7449:
URL: https://github.com/apache/incubator-nuttx/pull/7449#discussion_r1007362994
##########
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 + \
+ FLS32((size_t)(n) >> 32) : FLS32(n))
+#else
+#define FLS(n) FLS32(n)
Review Comment:
```suggestion
# define FLS(n) FLS32(n)
```
##########
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:
yeah, but many places will need such update. `ull` should work for RV64 as well
##########
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) & 0xffffffff00000000ull ? 32 + \
```
--
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-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org