This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 56286a72c6 PAGESIZE and PAGEMASK seems as common macro
56286a72c6 is described below

commit 56286a72c68f5f71f806e7af461d865fe96d3920
Author: Stanley <[email protected]>
AuthorDate: Sun Sep 10 14:35:30 2023 +0800

    PAGESIZE and PAGEMASK seems as common macro
---
 include/nuttx/page.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/nuttx/page.h b/include/nuttx/page.h
index 05a9980ac0..2971e14fb6 100644
--- a/include/nuttx/page.h
+++ b/include/nuttx/page.h
@@ -48,17 +48,18 @@
  */
 
 #if CONFIG_PAGING_PAGESIZE == 1024
-#  define PAGESIZE                 1024
 #  define PAGESHIFT                10
-#  define PAGEMASK                 0x000003ff
 #elif CONFIG_PAGING_PAGESIZE == 4096
-#  define PAGESIZE                 4096
 #  define PAGESHIFT                12
-#  define PAGEMASK                 0x00000fff
 #else
 #  error "Need extended definitions for CONFIG_PAGING_PAGESIZE"
 #endif
 
+/* Common page macros */
+
+#  define PAGESIZE                 (1 << PAGESHIFT)
+#  define PAGEMASK                 (PAGESIZE - 1)
+
 /* Alignment macros */
 
 #define PG_ALIGNDOWN(addr)         ((addr) & ~PAGEMASK)

Reply via email to