acassis commented on code in PR #10724:
URL: https://github.com/apache/nuttx/pull/10724#discussion_r1331669011
##########
arch/risc-v/src/common/riscv_pmp.c:
##########
@@ -100,32 +101,6 @@ 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)
-{
- uintptr_t pot = 0;
-
- for (size = size - 1; size > 1; size >>= 1)
- {
- pot++;
- }
-
- return pot;
-}
-
Review Comment:
@eenurkka maybe this log2ceil could be moved to libdsp or other place to be
reused for other arches that don't have it in binutils (older version of
binutils).
BTW did you see that:
https://stackoverflow.com/questions/15043483/faster-log2ceil
There is a faster implementation of log2ceil that just use logic shift and
AND operation
--
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]