You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "xiaoxiang781216 (via GitHub)" <gi...@apache.org> on 2023/08/31 03:45:34 UTC

[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #10451: riscv/riscv_pmp.c: Improve NAPOT area validity checks

xiaoxiang781216 commented on code in PR #10451:
URL: https://github.com/apache/nuttx/pull/10451#discussion_r1311056764


##########
arch/risc-v/src/common/riscv_pmp.c:
##########
@@ -100,6 +100,32 @@ typedef struct pmp_entry_s pmp_entry_t;
  * Private Functions
  ****************************************************************************/
 
+/****************************************************************************
+ * Name: log2ceil
+ *
+ * Description:
+ *   Calculate the up-rounded power-of-two for input.
+ *
+ * Input Parameters:
+ *   size - The size of the PMP region.
+ *
+ * Returned Value:
+ *   Power-of-two for argument, rounded up.
+ *
+ ****************************************************************************/
+
+static uintptr_t log2ceil(uintptr_t size)

Review Comment:
   can use LOG2_CEIL from https://github.com/apache/nuttx/blob/master/include/nuttx/lib/math32.h#L59



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